[prevent issues ID:55300,38821,19282,55298 for test_fileselector.c and elc_fileselect...
authorRajeev Ranjan <rajeev.r@samsung.com>
Sat, 15 Oct 2011 08:43:50 +0000 (14:13 +0530)
committerRajeev Ranjan <rajeev.r@samsung.com>
Tue, 8 Nov 2011 05:47:31 +0000 (11:17 +0530)
Change-Id: I761f66d7dba4f22ab201e0fc4fba633cb4077682

src/bin/test_fileselector.c
src/lib/elc_fileselector.c

index ba7b54c..2057fc5 100644 (file)
@@ -108,6 +108,7 @@ test_fileselector(void *data       __UNUSED__,
                   void *event_info __UNUSED__)
 {
    Evas_Object *win, *fs, *bg, *vbox, *hbox, *bt, *sep;
+   const char *path = NULL;
 
    /* Set the locale according to the system pref.
     * If you dont do so the file selector will order the files list in
@@ -137,7 +138,9 @@ test_fileselector(void *data       __UNUSED__,
    /* make the file list a tree with dir expandable in place */
    elm_fileselector_expandable_set(fs, EINA_FALSE);
    /* start the fileselector in the home dir */
-   elm_fileselector_path_set(fs, getenv("HOME"));
+   path = getenv("HOME");
+   if (!path) path = "./";
+   elm_fileselector_path_set(fs, path);
    /* allow fs to expand in x & y */
    evas_object_size_hint_weight_set(fs, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
    evas_object_size_hint_align_set(fs, EVAS_HINT_FILL, EVAS_HINT_FILL);
index 9d6e1a3..57c78dd 100644 (file)
@@ -476,7 +476,10 @@ _home(void            *data,
       void *event_info __UNUSED__)
 {
    Evas_Object *fs = data;
-   _populate(fs, getenv("HOME"), NULL);
+   const char *path = getenv("HOME");
+   if (!path) path = "./";
+   _populate(fs, path, NULL);
+
 }
 
 static void
@@ -1128,12 +1131,14 @@ elm_fileselector_selected_get(const Evas_Object *obj)
      {
         const char *name;
         char buf[PATH_MAX];
+        char *dir;
 
+        dir = wd->only_folder ? ecore_file_dir_get(wd->path) : strdup(wd->path);
         name = elm_entry_entry_get(wd->filename_entry);
         snprintf(buf, sizeof(buf), "%s/%s",
-                 wd->only_folder ? ecore_file_dir_get(wd->path) : wd->path,
-                 name);
+                 dir, name);
         eina_stringshare_replace(&wd->selection, buf);
+        if (dir) free(dir);
         return wd->selection;
      }