summaryrefslogtreecommitdiff
path: root/src/lib/eina
diff options
context:
space:
mode:
authorVincent Torri <vincent.torri@gmail.com>2019-04-17 15:30:34 +0100
committerCarsten Haitzler (Rasterman) <raster@rasterman.com>2019-04-17 17:44:12 +0100
commita30caf333eda83bb83a8083c34ca4dccfabf6b10 (patch)
tree4bb2a526d86a2bec807d6abdea34e4e0480ea489 /src/lib/eina
parentf75675cb62589274211485c8e525eb0f548b8f7e (diff)
eina_vpath: port to Windows
Test Plan: test example Reviewers: raster, cedric, zmike Subscribers: #reviewers, #committers Tags: #efl Differential Revision: https://phab.enlightenment.org/D8633
Diffstat (limited to 'src/lib/eina')
-rw-r--r--src/lib/eina/eina_vpath.c1
-rw-r--r--src/lib/eina/eina_vpath.h4
-rw-r--r--src/lib/eina/eina_vpath_xdg.c33
3 files changed, 36 insertions, 2 deletions
diff --git a/src/lib/eina/eina_vpath.c b/src/lib/eina/eina_vpath.c
index 207bb8a..25fa901 100644
--- a/src/lib/eina/eina_vpath.c
+++ b/src/lib/eina/eina_vpath.c
@@ -214,6 +214,7 @@ _fetch_user_homedir(char **str, const char *name, const char *error)
214#else 214#else
215 ERR("User fetching is disabled on this system\nThe string was: %s", error); 215 ERR("User fetching is disabled on this system\nThe string was: %s", error);
216 return EINA_FALSE; 216 return EINA_FALSE;
217 (void) name;
217#endif 218#endif
218} 219}
219 220
diff --git a/src/lib/eina/eina_vpath.h b/src/lib/eina/eina_vpath.h
index d06cb43..77c1e35 100644
--- a/src/lib/eina/eina_vpath.h
+++ b/src/lib/eina/eina_vpath.h
@@ -36,7 +36,7 @@
36 * (:app.tmp:)/some-temp-file/path/file.txt 36 * (:app.tmp:)/some-temp-file/path/file.txt
37 * 37 *
38 * (:usr.desktop:)/file-in-users-desktop-directory.txt 38 * (:usr.desktop:)/file-in-users-desktop-directory.txt
39 * (:usr.documents:)/letter-to-gradma.doc 39 * (:usr.documents:)/letter-to-grandma.doc
40 * (:usr.downloads:)/file-downloaded-here.zip 40 * (:usr.downloads:)/file-downloaded-here.zip
41 * (:usr.music:)/fave-song.mp3 41 * (:usr.music:)/fave-song.mp3
42 * (:usr.pictures:)/a-photo.,jpg 42 * (:usr.pictures:)/a-photo.,jpg
@@ -44,7 +44,7 @@
44 * (:usr.templates:)/some-template-document.txt 44 * (:usr.templates:)/some-template-document.txt
45 * (:usr.videos:)/some-video-file.mp4 45 * (:usr.videos:)/some-video-file.mp4
46 * (:usr.data:)/file-in-user-data-dir 46 * (:usr.data:)/file-in-user-data-dir
47 * (:usr.config:)/file-in-user-conifg-dir 47 * (:usr.config:)/file-in-user-config-dir
48 * (:usr.cache:)/file-in-user-cache-dir 48 * (:usr.cache:)/file-in-user-cache-dir
49 * (:usr.run:)/file-in-xdg-runtime-dir 49 * (:usr.run:)/file-in-xdg-runtime-dir
50 * (:usr.tmp:)/some-temp-file/path/file.txt 50 * (:usr.tmp:)/some-temp-file/path/file.txt
diff --git a/src/lib/eina/eina_vpath_xdg.c b/src/lib/eina/eina_vpath_xdg.c
index e6db4c2..9d1c320 100644
--- a/src/lib/eina/eina_vpath_xdg.c
+++ b/src/lib/eina/eina_vpath_xdg.c
@@ -21,6 +21,37 @@ eina_xdg_env_init(void)
21 21
22 memset(&user, 0, sizeof(Eina_Vpath_Interface_User)); 22 memset(&user, 0, sizeof(Eina_Vpath_Interface_User));
23 23
24#ifdef _WIN32
25
26# define ENV_SET(_env, _dir, _meta) \
27 char _meta [PATH_MAX + 128]; \
28 char *_meta##env = _env; \
29 char *_meta##dir = _dir; \
30 if (_meta##env) \
31 strcpy(_meta, getenv(_meta##env)); \
32 else \
33 strcpy(_meta, home); \
34 if (_meta##dir) \
35 strcat(_meta, _meta##dir); \
36 s = _meta; \
37 (&user)->_meta = s;
38
39 ENV_SET(NULL, "\\Desktop", desktop);
40 ENV_SET(NULL, "\\Documents", documents);
41 ENV_SET(NULL, "\\Downloads", downloads);
42 ENV_SET(NULL, "\\Music", music);
43 ENV_SET(NULL, "\\Pictures", pictures);
44 ENV_SET("CommonProgramFiles", NULL, pub);
45 ENV_SET("APPDATA", "\\Microsoft\\Windows\\Templates", templates);
46 ENV_SET(NULL, "\\Videos", videos);
47 ENV_SET("LOCALAPPDATA", NULL, data);
48 ENV_SET("LOCALAPPDATA", "\\Temp", tmp);
49 ENV_SET("APPDATA", NULL, config);
50 ENV_SET("LOCALAPPDATA", NULL, cache);
51 ENV_SET("APPDATA", NULL, run);
52
53#else /* _WIN32 */
54
24# if defined(HAVE_GETUID) && defined(HAVE_GETEUID) 55# if defined(HAVE_GETUID) && defined(HAVE_GETEUID)
25# define ENV_HOME_SET(_env, _dir, _meta) \ 56# define ENV_HOME_SET(_env, _dir, _meta) \
26 char _meta [PATH_MAX + 128]; \ 57 char _meta [PATH_MAX + 128]; \
@@ -80,5 +111,7 @@ eina_xdg_env_init(void)
80 else 111 else
81 user.run = s; 112 user.run = s;
82 113
114#endif /* _WIN32 */
115
83 eina_vpath_interface_user_set(&user); 116 eina_vpath_interface_user_set(&user);
84} 117}