summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCedric BAIL <cedric@osg.samsung.com>2015-05-14 21:26:44 +0200
committerCedric BAIL <cedric@osg.samsung.com>2015-05-14 21:26:44 +0200
commit58686474d6f2d85e34b021cf2a2a1dba4ef34a8c (patch)
tree84099e9164e11598c0d8aac415fcc73dfe780b0b
parent685cfef7d9f887008061bd394d47d1b309b91e80 (diff)
elementary: use portable way to get tmp and home environment.
-rw-r--r--src/bin/test_fileselector.c12
-rw-r--r--src/bin/test_map.c2
-rw-r--r--src/bin/test_panel.c12
-rw-r--r--src/lib/elm_config.c2
-rw-r--r--src/lib/elm_theme.c11
5 files changed, 9 insertions, 30 deletions
diff --git a/src/bin/test_fileselector.c b/src/bin/test_fileselector.c
index a0bd61d12..eade90127 100644
--- a/src/bin/test_fileselector.c
+++ b/src/bin/test_fileselector.c
@@ -518,9 +518,6 @@ test_fileselector(void *data EINA_UNUSED,
518{ 518{
519 Evas_Object *win, *fs, *box, *vbox, *sep; 519 Evas_Object *win, *fs, *box, *vbox, *sep;
520 char * home_env; 520 char * home_env;
521#ifdef _WIN32
522 char win_home_env[PATH_MAX];
523#endif
524 521
525 /* Set the locale according to the system pref. 522 /* Set the locale according to the system pref.
526 * If you don't do so the file selector will order the files list in 523 * If you don't do so the file selector will order the files list in
@@ -552,14 +549,7 @@ test_fileselector(void *data EINA_UNUSED,
552 /* make the file list a tree with dir expandable in place */ 549 /* make the file list a tree with dir expandable in place */
553 elm_fileselector_expandable_set(fs, EINA_FALSE); 550 elm_fileselector_expandable_set(fs, EINA_FALSE);
554 /* start the fileselector in the home dir */ 551 /* start the fileselector in the home dir */
555 home_env = getenv("HOME"); 552 home_env = eina_environment_home_get();
556#ifdef _WIN32
557 if (!home_env)
558 {
559 snprintf(win_home_env, sizeof(win_home_env), "%s%s", getenv("HOMEDRIVE"), getenv("HOMEPATH"));
560 home_env = strdup(win_home_env);
561 }
562#endif
563 elm_fileselector_path_set(fs, home_env); 553 elm_fileselector_path_set(fs, home_env);
564 554
565 /* provides suggested name (just for showing) */ 555 /* provides suggested name (just for showing) */
diff --git a/src/bin/test_map.c b/src/bin/test_map.c
index c032e660e..91bd7326c 100644
--- a/src/bin/test_map.c
+++ b/src/bin/test_map.c
@@ -547,7 +547,7 @@ _track_add(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSE
547 fs = elm_fileselector_add(fs_win); 547 fs = elm_fileselector_add(fs_win);
548 elm_fileselector_is_save_set(fs, EINA_TRUE); 548 elm_fileselector_is_save_set(fs, EINA_TRUE);
549 elm_fileselector_expandable_set(fs, EINA_FALSE); 549 elm_fileselector_expandable_set(fs, EINA_FALSE);
550 path = getenv("HOME"); 550 path = eina_environment_home_get();
551 //if "HOME" is not available, set current dir. path 551 //if "HOME" is not available, set current dir. path
552 if (!path) 552 if (!path)
553 path = "."; 553 path = ".";
diff --git a/src/bin/test_panel.c b/src/bin/test_panel.c
index 36cd3c245..2a63d43d7 100644
--- a/src/bin/test_panel.c
+++ b/src/bin/test_panel.c
@@ -92,21 +92,11 @@ _fill_list(Evas_Object *obj, Elm_Genlist_Item_Class *itc)
92 Eina_List *l; 92 Eina_List *l;
93 char *real; 93 char *real;
94 char *home_env = NULL; 94 char *home_env = NULL;
95#ifdef _WIN32
96 char win_home_env[PATH_MAX];
97#endif
98 unsigned int x = 0; 95 unsigned int x = 0;
99 96
100 if (!dirs) 97 if (!dirs)
101 { 98 {
102 home_env = getenv("HOME"); 99 home_env = eina_environment_home_get();
103#ifdef _WIN32
104 if(!home_env)
105 {
106 snprintf(win_home_env, sizeof(win_home_env), "%s%s", getenv("HOMEDRIVE"), getenv("HOMEPATH"));
107 home_env = strdup(win_home_env);
108 }
109#endif
110 if (!home_env) return; 100 if (!home_env) return;
111 if (!(d = opendir(home_env))) return; 101 if (!(d = opendir(home_env))) return;
112 while ((de = readdir(d)) && (x < LIST_ITEM_MAX)) 102 while ((de = readdir(d)) && (x < LIST_ITEM_MAX))
diff --git a/src/lib/elm_config.c b/src/lib/elm_config.c
index 1ea9036e4..fce54ee74 100644
--- a/src/lib/elm_config.c
+++ b/src/lib/elm_config.c
@@ -722,7 +722,7 @@ _elm_config_user_dir_snprintf(char *dst,
722 else 722 else
723#endif 723#endif
724 { 724 {
725 home = getenv("HOME"); 725 home = eina_environment_home_get();
726 if (!home) home = "/"; 726 if (!home) home = "/";
727#ifdef DOXDG 727#ifdef DOXDG
728 user_dir_len = eina_str_join_len 728 user_dir_len = eina_str_join_len
diff --git a/src/lib/elm_theme.c b/src/lib/elm_theme.c
index 67cea3eff..134dc0061 100644
--- a/src/lib/elm_theme.c
+++ b/src/lib/elm_theme.c
@@ -66,7 +66,7 @@ _elm_theme_file_item_add(Elm_Theme_Files *files, const char *item, Eina_Bool pre
66 Eina_File *f = NULL; 66 Eina_File *f = NULL;
67 const char *home; 67 const char *home;
68 68
69 home = getenv("HOME") ? getenv("HOME") : ""; 69 home = eina_environment_home_get();
70 buf = eina_strbuf_new(); 70 buf = eina_strbuf_new();
71 71
72 if ((item[0] == '/') || 72 if ((item[0] == '/') ||
@@ -682,7 +682,7 @@ elm_theme_list_item_path_get(const char *f, Eina_Bool *in_search_path)
682 682
683 if (!home) 683 if (!home)
684 { 684 {
685 home = getenv("HOME"); 685 home = eina_environment_home_get();
686 if (!home) home = ""; 686 if (!home) home = "";
687 } 687 }
688 688
@@ -761,7 +761,7 @@ elm_theme_name_available_list_new(void)
761 761
762 if (!home) 762 if (!home)
763 { 763 {
764 home = getenv("HOME"); 764 home = eina_environment_home_get();
765 if (!home) home = ""; 765 if (!home) home = "";
766 } 766 }
767 767
@@ -937,12 +937,11 @@ elm_theme_user_dir_get(void)
937{ 937{
938 static char *path = NULL; 938 static char *path = NULL;
939 char buf[PATH_MAX]; 939 char buf[PATH_MAX];
940 const char *home;
940 941
941 if (path) return path; 942 if (path) return path;
942 943
943 char *home = getenv("HOME"); 944 home = eina_environment_home_get();
944 if (!home) home = "";
945
946 snprintf(buf, sizeof(buf), "%s/"ELEMENTARY_BASE_DIR"/themes", home); 945 snprintf(buf, sizeof(buf), "%s/"ELEMENTARY_BASE_DIR"/themes", home);
947 path = strdup(buf); 946 path = strdup(buf);
948 947