summaryrefslogtreecommitdiff
path: root/src/lib/ecore_con
diff options
context:
space:
mode:
authorMarcel Hollerbach <mail@marcel-hollerbach.de>2018-08-20 12:58:35 -0400
committerMike Blumenkrantz <zmike@samsung.com>2018-08-20 12:58:35 -0400
commitf6579e47ab27782f5f97bab8b8f26d86d2ca4ff9 (patch)
tree4d8ac36eb0a6759565926639380af7c7cf201c79 /src/lib/ecore_con
parent77ce62e1d2da448eea32aaeb753dcba7a7808f57 (diff)
ecore_con: migrate to eina_vpath
Summary: the logic here was against the xdg standard, thus we migrate to eina_vpath which uses the correct xdg standard Depends on D6745 Reviewers: zmike, stefan_schmidt, #committers Reviewed By: zmike, #committers Subscribers: #reviewers, cedric, #committers, zmike Tags: #efl Differential Revision: https://phab.enlightenment.org/D6746
Diffstat (limited to 'src/lib/ecore_con')
-rw-r--r--src/lib/ecore_con/ecore_con_local.c37
1 files changed, 3 insertions, 34 deletions
diff --git a/src/lib/ecore_con/ecore_con_local.c b/src/lib/ecore_con/ecore_con_local.c
index 874fd7b2c7..b3568837b5 100644
--- a/src/lib/ecore_con/ecore_con_local.c
+++ b/src/lib/ecore_con/ecore_con_local.c
@@ -27,22 +27,6 @@
27#include "Ecore_Con.h" 27#include "Ecore_Con.h"
28#include "ecore_con_private.h" 28#include "ecore_con_private.h"
29 29
30#ifndef _WIN32
31static const char *
32_ecore_con_local_path_get(void)
33{
34 static char *homedir = NULL;
35 if (homedir) return homedir;
36
37#if defined(HAVE_GETUID) && defined(HAVE_GETEUID)
38 if (getuid() == geteuid()) homedir = getenv("XDG_RUNTIME_DIR");
39#endif
40 if (!homedir) homedir = (char *)eina_environment_home_get();
41 if (!homedir) homedir = (char *)eina_environment_tmp_get();
42 return homedir;
43}
44#endif
45
46EAPI char * 30EAPI char *
47ecore_con_local_path_new(Eina_Bool is_system, const char *name, int port) 31ecore_con_local_path_new(Eina_Bool is_system, const char *name, int port)
48{ 32{
@@ -84,26 +68,11 @@ ecore_con_local_path_new(Eina_Bool is_system, const char *name, int port)
84 68
85 if (!is_system) 69 if (!is_system)
86 { 70 {
87#if defined(HAVE_GETUID) && defined(HAVE_GETEUID)
88 if (getuid() == geteuid())
89#endif
90 homedir = _ecore_con_local_path_get();
91#if defined(HAVE_GETUID) && defined(HAVE_GETEUID)
92 else
93 {
94 struct passwd *pw = getpwent();
95
96 if ((!pw) || (!pw->pw_dir)) homedir = "/tmp";
97 else homedir = pw->pw_dir;
98 }
99#endif
100
101 if (port < 0) 71 if (port < 0)
102 snprintf(buf, sizeof(buf), "%s/.ecore/%s", 72 eina_vpath_resolve_snprintf(buf, sizeof(buf), "(:usr.run:)/.ecore/%s", name);
103 homedir, name);
104 else 73 else
105 snprintf(buf, sizeof(buf), "%s/.ecore/%s/%i", 74 eina_vpath_resolve_snprintf(buf, sizeof(buf), "(:usr.run:)/.ecore/%s/%i", name, port);
106 homedir, name, port); 75
107 return strdup(buf); 76 return strdup(buf);
108 } 77 }
109 else 78 else