stefan pushed a commit to branch master.

http://git.enlightenment.org/core/efl.git/commit/?id=12f92b4bfb3137157c669de4f034bc987bf36ccd

commit 12f92b4bfb3137157c669de4f034bc987bf36ccd
Author: Mike Blumenkrantz <[email protected]>
Date:   Thu Jul 19 19:45:34 2018 -0400

    edje_cc: change .mo file write location to be relative to the .edj file
    
    previously this would attempt to write the .mo file to the same directory
    that the .po file was found in, which is invalid in cases such as distcheck
    where the source directory is not writable
    
    @fix
    
    Differential Revision: https://phab.enlightenment.org/D6636
---
 src/bin/edje/edje_cc_out.c | 23 ++++++++++++++++-------
 1 file changed, 16 insertions(+), 7 deletions(-)

diff --git a/src/bin/edje/edje_cc_out.c b/src/bin/edje/edje_cc_out.c
index d94c4aa25e..df733fe304 100644
--- a/src/bin/edje/edje_cc_out.c
+++ b/src/bin/edje/edje_cc_out.c
@@ -1721,12 +1721,17 @@ data_thread_mo(void *data, Ecore_Thread *thread 
EINA_UNUSED)
    void *m = NULL;
    int bytes = 0;
 
-   // Search the mo file in all the -md ( mo directory )
-   EINA_LIST_FOREACH(mo_dirs, ll, dir_path)
+   if (mw->mo_path)
+     f = eina_file_open(mw->mo_path, 0);
+   if (!f)
      {
-        snprintf((char *)mo_path, sizeof(mo_path), "%s/%s/%s", dir_path, 
mw->mo_entry->locale, mw->mo_entry->mo_src);
-        f = eina_file_open(mo_path, 0);
-        if (f) break;
+        // Search the mo file in all the -md ( mo directory )
+        EINA_LIST_FOREACH(mo_dirs, ll, dir_path)
+          {
+             snprintf((char *)mo_path, sizeof(mo_path), "%s/%s/%s", dir_path, 
mw->mo_entry->locale, mw->mo_entry->mo_src);
+             f = eina_file_open(mo_path, 0);
+             if (f) break;
+          }
      }
    if (!f)
      {
@@ -1843,10 +1848,13 @@ data_write_mo(Eet_File *ef, int *mo_num)
                   sub_str[1] = 'm';
                   EINA_LIST_FOREACH(mo_dirs, ll, dir_path)
                     {
-                       snprintf((char *)mo_path, sizeof(mo_path), "%s/%s/%s", 
dir_path, mw->mo_entry->locale, mw->mo_entry->mo_src);
                        snprintf((char *)po_path, sizeof(po_path), "%s/%s/%s", 
dir_path, mw->mo_entry->locale, po_entry);
                        if (ecore_file_exists(po_path))
                          {
+                            char *mo_dir = 
ecore_file_dir_get(eet_file_get(ef));
+                            snprintf((char *)mo_path, sizeof(mo_path), 
"%s/%s", mo_dir, mw->mo_entry->locale);
+                            ecore_file_mkpath(mo_path);
+                            snprintf((char *)mo_path, sizeof(mo_path), 
"%s/%s/%s", mo_dir, mw->mo_entry->locale, mw->mo_entry->mo_src);
                             snprintf(buf, sizeof(buf), "msgfmt -o %s %s", 
mo_path, po_path);
                             mw2 = malloc(sizeof(Mo_Write));
                             if (mw2)
@@ -1857,9 +1865,10 @@ data_write_mo(Eet_File *ef, int *mo_num)
                                  ecore_event_handler_add(ECORE_EXE_EVENT_DEL,
                                                          _exe_del_cb, mw2);
                               }
+                            free(mo_dir);
                          }
                        else
-                         error_and_abort(mw->ef, "Invalid .po file \"%s\".", 
po_path);
+                         error_and_abort(mw->ef, "Non-existent .po file 
specified: \"%s\".", po_path);
                     }
                   free(mw);
                }

-- 


Reply via email to