summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormichelle legrand <michelle.legrand@openwide.fr>2015-02-11 14:53:40 +0100
committerCedric BAIL <cedric@osg.samsung.com>2015-03-26 18:11:56 +0100
commit36f5d2034b20a25b975dc30f9376ba86bc34e5dd (patch)
treecfc36c25ea1600114d0c89a92ea5385ac501aa73
parentfad2f79bacf79e37bafbf0252a1560b199a8b5ee (diff)
downloadelementary-36f5d2034b20a25b975dc30f9376ba86bc34e5dd.tar.gz
elm_panel: display directory from HOME on Windows.
Summary: On Windows we can get the HOME environment variable if we launch the application from Msys or Cygwin, otherwise we need to use "HOMEDRIVE" and "HOMEPATH" to get windows home path. @fix Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
-rw-r--r--src/bin/test_panel.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/bin/test_panel.c b/src/bin/test_panel.c
index b98bc76d9..a4137025a 100644
--- a/src/bin/test_panel.c
+++ b/src/bin/test_panel.c
@@ -92,11 +92,19 @@ _fill_list(Evas_Object *obj, Elm_Genlist_Item_Class *itc)
Eina_List *l;
char *real;
char *home_env = NULL;
+ char win_home_env[PATH_MAX];
unsigned int x = 0;
if (!dirs)
{
home_env = getenv("HOME");
+#ifdef _WIN32
+ if(!home_env)
+ {
+ snprintf(win_home_env, sizeof(win_home_env), "%s%s", getenv("HOMEDRIVE"), getenv("HOMEPATH"));
+ home_env = strdup(win_home_env);
+ }
+#endif
if (!home_env) return;
if (!(d = opendir(home_env))) return;
while ((de = readdir(d)) && (x < LIST_ITEM_MAX))
@@ -104,7 +112,8 @@ _fill_list(Evas_Object *obj, Elm_Genlist_Item_Class *itc)
char buff[PATH_MAX];
if (de->d_name[0] == '.') continue;
- snprintf(buff, sizeof(buff), "%s/%s", getenv("HOME"), de->d_name);
+ snprintf(buff, sizeof(buff), "%s/%s", home_env, de->d_name);
+
if (!ecore_file_is_dir(buff)) continue;
x++;
real = ecore_file_realpath(buff);