Use relative paths instead of full path to avoid too long commands 82/16082/3
Vincent COUVERT [Wed, 4 Mar 2015 10:13:22 +0000 (11:13 +0100)]
Change-Id: I44faa99001d8bdba35f6df77767a7474da42cdf5

scilab/tools/localization/generatePoFile.sce

index 3461a8c..58e1b40 100644 (file)
@@ -18,10 +18,12 @@ function  generatePoFile(LANGUAGE)
     end
 
     LC = "LC_MESSAGES";
-    DEST_FILE_MO = SCI + filesep() + "locale" + filesep() + LANGUAGE + filesep() + LC + filesep() + "scilab.mo";
-    DEST_FILE_PO = strsubst(DEST_FILE_MO, "scilab.mo", "scilab.po");
+    DEST_PATH_MO = SCI + filesep() + "locale" + filesep() + LANGUAGE + filesep() + LC + filesep();
+    DEST_FILE_MO = "scilab.mo";
+    DEST_FILE_PO = "scilab.po";
     LC = "LC_MESSAGES";
     PATH_GETTEXT_TOOLS = SCI + filesep() + "tools/gettext";
+    PATH_GETTEXT_TOOLS = getrelativefilename(DEST_PATH_MO, PATH_GETTEXT_TOOLS);
 
     // make destination directories
     if ~isdir(SCI + filesep() + "locale") then
@@ -48,21 +50,24 @@ function  generatePoFile(LANGUAGE)
     for k = 1:size(PATH_PO, "*")
         if LANGUAGE ==  "en_US" then
             if findfiles(PATH_PO(k), FILENAME_PO(k)) <> [] then
-                List_files = [List_files ; fullpath(PATH_PO(k) +  FILENAME_PO(k))];
+                List_files = [List_files ; getrelativefilename(DEST_PATH_MO, fullpath(PATH_PO(k) +  FILENAME_PO(k)))];
             end
         else
             if findfiles(PATH_PO(k), FILENAME_PO) <> [] then
-                List_files = [List_files ; fullpath(PATH_PO(k) +  FILENAME_PO)];
+                List_files = [List_files ; getrelativefilename(DEST_PATH_MO, fullpath(PATH_PO(k) +  FILENAME_PO))];
             end
         end
     end
 
     if (List_files <> []) then
-        if newest([DEST_FILE_MO; List_files]) <> 1 then
+        if newest([DEST_PATH_MO + DEST_FILE_MO; DEST_PATH_MO + List_files]) <> 1 then
+            curPath = pwd();
+            cd(DEST_PATH_MO)
             cmdline_msgcat = PATH_GETTEXT_TOOLS + filesep() + "msgcat --use-first -o " + DEST_FILE_PO + " " + strcat("""" + List_files + """", " ");
             unix(cmdline_msgcat);
             cmline_msgfmt = PATH_GETTEXT_TOOLS + filesep() + "msgfmt --statistics -o " + DEST_FILE_MO + " " + DEST_FILE_PO;
             unix(cmline_msgfmt);
+            cd(curPath)
         end
     end