sync to last commit on google_code
[goodguy/history.git] / cinelerra-5.0 / cinelerra / main.C
index 9f9149d8ee9c8f8fb58dffe89fa0f1f191e25fd2..2f167ac0df30019fc80c63701d11e6cd6ccd3016 100644 (file)
@@ -22,6 +22,7 @@
 #include "batchrender.h"
 #include "bcsignals.h"
 #include "edl.h"
+#include "file.inc"
 #include "filexml.h"
 #include "fileserver.h"
 #include "filesystem.h"
@@ -91,25 +92,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 +107,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 +117,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 +177,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
@@ -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
@@ -298,14 +283,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);