hermet pushed a commit to branch master.

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

commit a281963ba1d9f06874873b9b0bedac40d02d85e8
Author: Hermet Park <[email protected]>
Date:   Tue Aug 9 01:02:46 2016 +0900

    sanitize compare file pathes.
    
    let's have a full pathes for enventor items.
    then we don't need to call ecore_file_realpath() at every accesses.
---
 src/bin/file_mgr.c       | 28 +++++++++++++---------------
 src/bin/file_tab.c       |  4 +---
 src/lib/enventor_smart.c |  7 -------
 3 files changed, 14 insertions(+), 25 deletions(-)

diff --git a/src/bin/file_mgr.c b/src/bin/file_mgr.c
index 5102579..bcb88f5 100644
--- a/src/bin/file_mgr.c
+++ b/src/bin/file_mgr.c
@@ -263,7 +263,17 @@ file_mgr_main_file_set(const char *path)
         return NULL;
      }
 
-   char *realpath = ecore_file_realpath(path);
+   char *realpath;
+
+   if (ecore_file_exists(path))
+     realpath = ecore_file_realpath(path);
+   else
+     {
+        //This main file is not created yet.
+        FILE *fp = fopen(path, "w");
+        if (fp) fclose(fp);
+        realpath = ecore_file_realpath(path);
+     }
 
    //Same with previous?
    Enventor_Item *main_it = file_mgr_main_item_get();
@@ -418,17 +428,11 @@ file_mgr_file_open(const char *file_path)
              return EINA_FALSE;
           }
         //Ok, This selected file is already openend, let's activate the item.
-        char *txt1 = ecore_file_realpath(file_path);
-        char *txt2 = ecore_file_realpath(it_file_path);
-        if (!strcmp(txt1, txt2))
+        if (!strcmp(file_path, it_file_path))
           {
              file_mgr_file_focus(eit);
-             free(txt1);
-             free(txt2);
              return EINA_TRUE;
           }
-        free(txt1);
-        free(txt2);
      }
 
    //Case 2. sub files.
@@ -441,17 +445,11 @@ file_mgr_file_open(const char *file_path)
         if (!it_file_path) continue;
 
         //Ok, This selected file is already openend, let's activate the item.
-        char *txt1 = ecore_file_realpath(file_path);
-        char *txt2 = ecore_file_realpath(it_file_path);
-        if (!strcmp(txt1, txt2))
+        if (!strcmp(file_path, it_file_path))
           {
              file_mgr_file_focus(eit);
-             free(txt1);
-             free(txt2);
              return EINA_TRUE;
           }
-        free(txt1);
-        free(txt2);
      }
 
    //This selected file hasn't been opened yet, so let's open this file newly.
diff --git a/src/bin/file_tab.c b/src/bin/file_tab.c
index 9dcf113..8bd5590 100644
--- a/src/bin/file_tab.c
+++ b/src/bin/file_tab.c
@@ -219,9 +219,7 @@ file_tab_it_add(Enventor_Item *enventor_it)
    fti->it = elm_list_item_append(fd->list, filename, btn, NULL,
                                   list_item_selected_cb, fti);
 
-   char *txt = ecore_file_realpath(filepath);
-   elm_object_item_tooltip_text_set(fti->it, txt);
-   free(txt);
+   elm_object_item_tooltip_text_set(fti->it, filepath);
 
    elm_list_go(fd->list);
 
diff --git a/src/lib/enventor_smart.c b/src/lib/enventor_smart.c
index ac399c9..b8500a8 100644
--- a/src/lib/enventor_smart.c
+++ b/src/lib/enventor_smart.c
@@ -391,13 +391,6 @@ _enventor_object_efl_file_file_set(Eo *obj EINA_UNUSED,
    build_edc_path_set(file);
    if (!file) goto err;
 
-   /* Create empty file*/
-   if (!ecore_file_exists(file))
-     {
-         FILE *fp = fopen(file, "w");
-         if (fp) fclose(fp);
-     }
-
    if (!edit_load(pd->main_it->ed, file)) return EINA_FALSE;
    build_edc();
    edit_changed_set(pd->main_it->ed, EINA_FALSE);

-- 


Reply via email to