forked from enlightenment/efl
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
This commit is contained in:
parent
f75675cb62
commit
a30caf333e
|
@ -214,6 +214,7 @@ _fetch_user_homedir(char **str, const char *name, const char *error)
|
|||
#else
|
||||
ERR("User fetching is disabled on this system\nThe string was: %s", error);
|
||||
return EINA_FALSE;
|
||||
(void) name;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
|
@ -36,7 +36,7 @@
|
|||
* (:app.tmp:)/some-temp-file/path/file.txt
|
||||
*
|
||||
* (:usr.desktop:)/file-in-users-desktop-directory.txt
|
||||
* (:usr.documents:)/letter-to-gradma.doc
|
||||
* (:usr.documents:)/letter-to-grandma.doc
|
||||
* (:usr.downloads:)/file-downloaded-here.zip
|
||||
* (:usr.music:)/fave-song.mp3
|
||||
* (:usr.pictures:)/a-photo.,jpg
|
||||
|
@ -44,7 +44,7 @@
|
|||
* (:usr.templates:)/some-template-document.txt
|
||||
* (:usr.videos:)/some-video-file.mp4
|
||||
* (:usr.data:)/file-in-user-data-dir
|
||||
* (:usr.config:)/file-in-user-conifg-dir
|
||||
* (:usr.config:)/file-in-user-config-dir
|
||||
* (:usr.cache:)/file-in-user-cache-dir
|
||||
* (:usr.run:)/file-in-xdg-runtime-dir
|
||||
* (:usr.tmp:)/some-temp-file/path/file.txt
|
||||
|
|
|
@ -21,6 +21,37 @@ eina_xdg_env_init(void)
|
|||
|
||||
memset(&user, 0, sizeof(Eina_Vpath_Interface_User));
|
||||
|
||||
#ifdef _WIN32
|
||||
|
||||
# define ENV_SET(_env, _dir, _meta) \
|
||||
char _meta [PATH_MAX + 128]; \
|
||||
char *_meta##env = _env; \
|
||||
char *_meta##dir = _dir; \
|
||||
if (_meta##env) \
|
||||
strcpy(_meta, getenv(_meta##env)); \
|
||||
else \
|
||||
strcpy(_meta, home); \
|
||||
if (_meta##dir) \
|
||||
strcat(_meta, _meta##dir); \
|
||||
s = _meta; \
|
||||
(&user)->_meta = s;
|
||||
|
||||
ENV_SET(NULL, "\\Desktop", desktop);
|
||||
ENV_SET(NULL, "\\Documents", documents);
|
||||
ENV_SET(NULL, "\\Downloads", downloads);
|
||||
ENV_SET(NULL, "\\Music", music);
|
||||
ENV_SET(NULL, "\\Pictures", pictures);
|
||||
ENV_SET("CommonProgramFiles", NULL, pub);
|
||||
ENV_SET("APPDATA", "\\Microsoft\\Windows\\Templates", templates);
|
||||
ENV_SET(NULL, "\\Videos", videos);
|
||||
ENV_SET("LOCALAPPDATA", NULL, data);
|
||||
ENV_SET("LOCALAPPDATA", "\\Temp", tmp);
|
||||
ENV_SET("APPDATA", NULL, config);
|
||||
ENV_SET("LOCALAPPDATA", NULL, cache);
|
||||
ENV_SET("APPDATA", NULL, run);
|
||||
|
||||
#else /* _WIN32 */
|
||||
|
||||
# if defined(HAVE_GETUID) && defined(HAVE_GETEUID)
|
||||
# define ENV_HOME_SET(_env, _dir, _meta) \
|
||||
char _meta [PATH_MAX + 128]; \
|
||||
|
@ -80,5 +111,7 @@ eina_xdg_env_init(void)
|
|||
else
|
||||
user.run = s;
|
||||
|
||||
#endif /* _WIN32 */
|
||||
|
||||
eina_vpath_interface_user_set(&user);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue