hermet pushed a commit to branch master.

http://git.enlightenment.org/tools/enventor.git/commit/?id=5ff7e99169999383bae1bbd27475f6c498a2352b

commit 5ff7e99169999383bae1bbd27475f6c498a2352b
Author: ChunEon Park <[email protected]>
Date:   Fri Oct 31 23:04:31 2014 +0900

    app/config_data: make compatible with windows.
    
    save temporary edj file in folder which is generated by eina_file_mkstemp()
    
    suggested by adrien.
---
 src/bin/config_data.c | 20 +++++++++++++++-----
 1 file changed, 15 insertions(+), 5 deletions(-)

diff --git a/src/bin/config_data.c b/src/bin/config_data.c
index fdc38c9..cd4e334 100644
--- a/src/bin/config_data.c
+++ b/src/bin/config_data.c
@@ -41,17 +41,27 @@ config_edj_path_update(config_data *cd)
 {
    //apply edj path also
    char buf[PATH_MAX];
-   char edj_path[PATH_MAX];
+   Eina_Tmpstr *tmp_path;
 
    char *ext = strstr(cd->edc_path, ".edc");
    const char *file = ecore_file_file_get(cd->edc_path);
    if (ext && file)
-     snprintf(buf, (ext - file) + 1, "%s", file);
+     {
+        char filename[PATH_MAX];
+        snprintf(filename, (ext - file) + 1, "%s", file);
+        snprintf(buf, sizeof(buf), "%s_XXXXXX.edj", filename);
+     }
    else
-     strncpy(buf, file, sizeof(buf) - 1);
-   sprintf(edj_path, "/tmp/%s.edj", buf);
+     snprintf(buf, sizeof(buf), "%s_XXXXXX.edj", file);
+
+   if (!eina_file_mkstemp(buf, &tmp_path))
+     {
+        EINA_LOG_ERR("Failed to generate tmp folder!");
+        return;
+     }
 
-   eina_stringshare_replace(&cd->edj_path, edj_path);
+   eina_stringshare_replace(&cd->edj_path, buf);
+   eina_tmpstr_del(tmp_path);
 }
 
 static void

-- 


Reply via email to