summaryrefslogtreecommitdiff
path: root/src/lib/ecore_con
diff options
context:
space:
mode:
authorCedric BAIL <cedric@osg.samsung.com>2015-05-14 18:40:47 +0200
committerCedric BAIL <cedric@osg.samsung.com>2015-05-14 18:41:48 +0200
commit94eaaf889b92d3dd3897488ba141108b4369268f (patch)
treebbf7c0ed02a0a54b41f303a8ae8e781a93b074bc /src/lib/ecore_con
parent9e2f846830475cbe851630f69af1d4dda2088b5c (diff)
ecore_con: use portable environment lookup.
Diffstat (limited to 'src/lib/ecore_con')
-rw-r--r--src/lib/ecore_con/ecore_con_local.c21
1 files changed, 6 insertions, 15 deletions
diff --git a/src/lib/ecore_con/ecore_con_local.c b/src/lib/ecore_con/ecore_con_local.c
index dc9a78e2bf..2c5ca87e5e 100644
--- a/src/lib/ecore_con/ecore_con_local.c
+++ b/src/lib/ecore_con/ecore_con_local.c
@@ -37,20 +37,11 @@
37 37
38static int _ecore_con_local_init_count = 0; 38static int _ecore_con_local_init_count = 0;
39 39
40static inline const char *_ecore_con_get_tmpdir()
41{
42 const char *tmpdir = "/tmp";
43 const char *dir = getenv("TMPDIR");
44
45 if (!dir) return tmpdir;
46 return dir;
47}
48
49static const char *_ecore_con_local_path_get() 40static const char *_ecore_con_local_path_get()
50{ 41{
51 const char *homedir = getenv("XDG_RUNTIME_DIR"); 42 const char *homedir = getenv("XDG_RUNTIME_DIR");
52 if (!homedir) homedir = getenv("HOME"); 43 if (!homedir) homedir = eina_environment_home_get();
53 if (!homedir) homedir = _ecore_con_get_tmpdir(); 44 if (!homedir) homedir = eina_environment_tmp_get();
54 45
55 return homedir; 46 return homedir;
56} 47}
@@ -124,7 +115,7 @@ ecore_con_local_connect(Ecore_Con_Server *obj,
124 } 115 }
125 else 116 else
126 { 117 {
127 homedir = _ecore_con_get_tmpdir(); 118 homedir = eina_environment_tmp_get();
128 snprintf(buf, sizeof(buf), "%s/.ecore_service|%s", 119 snprintf(buf, sizeof(buf), "%s/.ecore_service|%s",
129 homedir, svr->name); 120 homedir, svr->name);
130 } 121 }
@@ -135,7 +126,7 @@ ecore_con_local_connect(Ecore_Con_Server *obj,
135 snprintf(buf, sizeof(buf), "%s|%i", svr->name, svr->port); 126 snprintf(buf, sizeof(buf), "%s|%i", svr->name, svr->port);
136 else 127 else
137 { 128 {
138 homedir = _ecore_con_get_tmpdir(); 129 homedir = eina_environment_tmp_get();
139 snprintf(buf, sizeof(buf), "%s/.ecore_service|%s|%i", 130 snprintf(buf, sizeof(buf), "%s/.ecore_service|%s|%i",
140 homedir, svr->name, svr->port); 131 homedir, svr->name, svr->port);
141 } 132 }
@@ -285,7 +276,7 @@ ecore_con_local_listen(
285 } 276 }
286 else 277 else
287 { 278 {
288 homedir = _ecore_con_get_tmpdir(); 279 homedir = eina_environment_tmp_get();
289 snprintf(buf, sizeof(buf), "%s/.ecore_service|%s", 280 snprintf(buf, sizeof(buf), "%s/.ecore_service|%s",
290 homedir, svr->name); 281 homedir, svr->name);
291 } 282 }
@@ -296,7 +287,7 @@ ecore_con_local_listen(
296 snprintf(buf, sizeof(buf), "%s|%i", svr->name, svr->port); 287 snprintf(buf, sizeof(buf), "%s|%i", svr->name, svr->port);
297 else 288 else
298 { 289 {
299 homedir = _ecore_con_get_tmpdir(); 290 homedir = eina_environment_tmp_get();
300 snprintf(buf, sizeof(buf), "%s/.ecore_service|%s|%i", 291 snprintf(buf, sizeof(buf), "%s/.ecore_service|%s|%i",
301 homedir, svr->name, svr->port); 292 homedir, svr->name, svr->port);
302 } 293 }