X-Git-Url: http://git.cinelerra-gg.org/git/?a=blobdiff_plain;f=cinelerra-5.0%2Fcinelerra%2Fmain.C;h=69895ec4c996df5fb1f065986896e8e9cc5821b7;hb=1784ebd93b6c278a5205f040b5b40d8bdd79ed8a;hp=de0743ef6954da9c28f54351853d3f702fa530a9;hpb=2d99bb8ce591f05a31464b517d85dc2bc35b2abe;p=goodguy%2Fhistory.git diff --git a/cinelerra-5.0/cinelerra/main.C b/cinelerra-5.0/cinelerra/main.C index de0743ef..69895ec4 100644 --- a/cinelerra-5.0/cinelerra/main.C +++ b/cinelerra-5.0/cinelerra/main.C @@ -22,8 +22,8 @@ #include "batchrender.h" #include "bcsignals.h" #include "edl.h" +#include "file.inc" #include "filexml.h" -#include "fileserver.h" #include "filesystem.h" #include "language.h" #include "langinfo.h" @@ -91,25 +91,6 @@ public: }; -void get_exe_path(char *result) -{ -// Get executable path - pid_t pid = getpid(); - char proc_path[BCTEXTLEN]; - int len = 0; - result[0] = 0; - sprintf(proc_path, "/proc/%d/exe", pid); - if((len = readlink(proc_path, result, BCTEXTLEN)) >= 0) - { - result[len] = 0; -//printf("Preferences::Preferences %d %s\n", __LINE__, result); - char *ptr = strrchr(result, '/'); - if(ptr) *ptr = 0; - } - -} - - int main(int argc, char *argv[]) { // handle command line arguments first @@ -125,6 +106,7 @@ int main(int argc, char *argv[]) char batch_path[BCTEXTLEN]; char locale_path[BCTEXTLEN]; char exe_path[BCTEXTLEN]; + char env_path[BCTEXTLEN]; int nice_value = 20; int start_remote_control = 0; config_path[0] = 0; @@ -134,6 +116,8 @@ int main(int argc, char *argv[]) get_exe_path(exe_path); + snprintf(env_path, sizeof(env_path), "CINELERRA_PATH=%s", exe_path); + putenv(env_path); sprintf(locale_path, "%s%s", exe_path, LOCALEDIR); @@ -192,7 +176,7 @@ int main(int argc, char *argv[]) strcpy(BC_Resources::language, locbuf); } else - printf(PROGRAM_NAME ": Could not set locale.\n"); + printf(_(PROGRAM_NAME ": Could not set locale.\n")); #else setlocale(LC_CTYPE, ""); #endif @@ -202,6 +186,7 @@ int main(int argc, char *argv[]) + int load_backup = 0; for(int i = 1; i < argc; i++) { @@ -237,7 +222,7 @@ int main(int argc, char *argv[]) } else { - fprintf(stderr, "%s: -c needs a filename.\n", argv[0]); + fprintf(stderr, _("%s: -c needs a filename.\n"), argv[0]); } } else @@ -263,7 +248,7 @@ int main(int argc, char *argv[]) operation = DO_BRENDER; if(i > argc - 2) { - fprintf(stderr, "-b may not be used by the user.\n"); + fprintf(stderr, _("-b may not be used by the user.\n")); exit(1); } else @@ -279,6 +264,11 @@ int main(int argc, char *argv[]) } } else + if(!strcmp(argv[i], "-x")) + { + load_backup = 1; + } + else { char *new_filename; new_filename = new char[BCTEXTLEN]; @@ -298,14 +288,11 @@ int main(int argc, char *argv[]) operation == DO_USAGE || operation == DO_BATCHRENDER) fprintf(stderr, - PROGRAM_NAME " " - CINELERRA_VERSION " " - "(C)%d Adam Williams\n\n" - -PROGRAM_NAME " is free software, covered by the GNU General Public License,\n" -"and you are welcome to change it and/or distribute copies of it under\n" -"certain conditions. There is absolutely no warranty for " PROGRAM_NAME ".\n", -COPYRIGHT_DATE); + _(PROGRAM_NAME " " CINELERRA_VERSION " " "(C)%d Adam Williams\n\n" + PROGRAM_NAME " is free software, covered by the GNU General Public License,\n" + "and you are welcome to change it and/or distribute copies of it under\n" + "certain conditions. There is absolutely no warranty for " PROGRAM_NAME ".\n"), + COPYRIGHT_DATE); @@ -367,14 +354,12 @@ COPYRIGHT_DATE); BatchRenderThread *thread = new BatchRenderThread; thread->start_rendering(config_path, batch_path); - delete MWindow::file_server; break; } case DO_GUI: { int done = 0; - int load_backup = 0; while( !done ) { BC_WindowBase::get_resources()->vframe_shm = 0; MWindow mwindow; @@ -404,6 +389,7 @@ COPYRIGHT_DATE); // run the program //PRINT_TRACE mwindow.start(); + mwindow.run(); //PRINT_TRACE if( mwindow.reload() ) start_remote_control = @@ -418,6 +404,15 @@ COPYRIGHT_DATE); mwindow.save_defaults(); //PRINT_TRACE filenames.remove_all_objects(); +#if 1 + if( !mwindow.reload() ) break; +// due to leaks and munges in x fonts, this loop has to be +// executed via a total program restart 2/18/2016 + char exe_path[BCTEXTLEN]; + if( readlink("/proc/self/exe", exe_path, sizeof(exe_path)) < 0 ) break; + char *const av[3] = { exe_path, (char*)(load_backup? "-x" : 0), 0 }; + execv(exe_path, av); +#endif } //SET_TRACE DISABLE_BUFFER