Edje_Edit: use specific function to get file's name correctly on Win and Linux
authorVitalii Vorobiov <vi.vorobiov@samsung.com>
Fri, 25 Nov 2016 13:00:49 +0000 (15:00 +0200)
committerWonki Kim <wonki_.kim@samsung.com>
Mon, 2 Jan 2017 07:23:55 +0000 (16:23 +0900)
Because '\' is dir path for linux, but '/' is dir path for Window,
so better use specific function for getting file's name depending on specific
system

Change-Id: I34f999eaa2aabbe60994bce82a804457002b2879
Signed-off-by: Vitalii Vorobiov <vi.vorobiov@samsung.com>
src/lib/edje/edje_edit.c

index da55651..5f145b6 100644 (file)
@@ -8231,7 +8231,7 @@ EAPI Eina_Bool
 edje_edit_font_add(Evas_Object *obj, const char *path, const char *alias)
 {
    char entry[PATH_MAX];
-   char *new_path;
+   const char *new_path;
    struct stat st;
    Edje_Font_Directory_Entry *fnt;
 
@@ -8247,14 +8247,12 @@ edje_edit_font_add(Evas_Object *obj, const char *path, const char *alias)
    /* Alias */
    if (alias)
      {
-        if ((new_path = strrchr(path, '/'))) new_path++;
-        else new_path = (char *)path;
+        new_path = ecore_file_file_get(path);
      }
    else
      {
-        if ((alias = strrchr(path, '/'))) alias++;
-        else alias = (char *)path;
-        new_path = (char *)alias;
+        alias = ecore_file_file_get(path);
+        new_path = alias;
      }
    snprintf(entry, sizeof(entry), "edje/fonts/%s", alias);
 
@@ -9311,7 +9309,7 @@ edje_edit_image_add(Evas_Object *obj, const char *path)
    Edje_Image_Directory_Entry *de;
    unsigned int i;
    int free_id = -1;
-   char *name;
+   const char *name;
 
    GET_ED_OR_RETURN(EINA_FALSE);
 
@@ -9327,8 +9325,7 @@ edje_edit_image_add(Evas_Object *obj, const char *path)
      }
 
    /* Image name */
-   if ((name = strrchr(path, '/'))) name++;
-   else name = (char *)path;
+   name = ecore_file_file_get(path);
 
    /* Loop trough image directory to find if image exist */
    for (i = 0; i < ed->file->image_dir->entries_count; ++i)