From ce1d59bcbe8ce87316b7bd9c7d1d2261047c9f8d Mon Sep 17 00:00:00 2001 From: michelle legrand Date: Wed, 11 Feb 2015 14:57:44 +0100 Subject: [PATCH] elm_fileselector: display directory from HOME on Windows. Summary: On Windows, if we are running the application from Msys or Cygwin, we will get the HOME environment variable. Otherwise we need to use Windows environment variables "HOMEDRIVE" and "HOMEPATH" to get the home path. @fix Signed-off-by: Cedric BAIL --- legacy/elementary/src/bin/test_fileselector.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/legacy/elementary/src/bin/test_fileselector.c b/legacy/elementary/src/bin/test_fileselector.c index 18dcae602b..28fb30dee3 100644 --- a/legacy/elementary/src/bin/test_fileselector.c +++ b/legacy/elementary/src/bin/test_fileselector.c @@ -517,6 +517,8 @@ test_fileselector(void *data EINA_UNUSED, void *event_info EINA_UNUSED) { Evas_Object *win, *fs, *box, *vbox, *sep; + char * home_env; + char win_home_env[PATH_MAX]; /* Set the locale according to the system pref. * If you don't do so the file selector will order the files list in @@ -548,7 +550,15 @@ test_fileselector(void *data EINA_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")); + 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 + elm_fileselector_path_set(fs, home_env); /* provides suggested name (just for showing) */ elm_fileselector_current_name_set(fs, "No name");