summaryrefslogtreecommitdiff
path: root/src/lib/eina
diff options
context:
space:
mode:
authorVincent Torri <vincent.torri@gmail.com>2019-05-08 20:28:05 +0000
committerMarcel Hollerbach <mail@marcel-hollerbach.de>2019-05-12 11:56:04 +0200
commit59f8516ec5d52bc774942b8988c768104c08d472 (patch)
tree7d7defee3df2cb99501c38cc6d219d3e7ac0e707 /src/lib/eina
parentc75415ae369f5988975bc6e40378d9de5e2ccef0 (diff)
eina vpath: fix warning on Windows, as well as the public path
Differential Revision: https://phab.enlightenment.org/D8866
Diffstat (limited to 'src/lib/eina')
-rw-r--r--src/lib/eina/eina_vpath_xdg.c38
1 files changed, 23 insertions, 15 deletions
diff --git a/src/lib/eina/eina_vpath_xdg.c b/src/lib/eina/eina_vpath_xdg.c
index bd36042..0db6e78 100644
--- a/src/lib/eina/eina_vpath_xdg.c
+++ b/src/lib/eina/eina_vpath_xdg.c
@@ -28,28 +28,36 @@ eina_xdg_env_init(void)
28 } while (0) 28 } while (0)
29 29
30#ifdef _WIN32 30#ifdef _WIN32
31# define ENV_SET(_env, _dir, _meta) \ 31# define ENV_DIR_SET(_env, _dir, _meta) \
32 char _meta[PATH_MAX + 128]; \ 32 char _meta[PATH_MAX + 128]; \
33 if (_env) { \ 33 if (_env) { \
34 s = getenv(_env); \ 34 s = getenv(_env); \
35 if (!s) s = home; \ 35 if (!s) s = home; \
36 } else s = home; \ 36 } else s = home; \
37 if (_dir) FATAL_SNPRINTF(_meta, "vpath string '%s' truncated - fatal", "%s\\%s", s, (char *)_dir); \ 37 FATAL_SNPRINTF(_meta, "vpath string '%s' truncated - fatal", "%s\\%s", s, (char *)_dir); \
38 else FATAL_SNPRINTF(_meta, "vpath string '%s' truncated - fatal", "%s\\", s); \
39 (&user)->_meta = _meta; 38 (&user)->_meta = _meta;
40 39
41 ENV_SET(NULL, "Desktop", desktop); 40# define ENV_SET(_env, _meta) \
42 ENV_SET(NULL, "Documents", documents); 41 char _meta[PATH_MAX + 128]; \
43 ENV_SET(NULL, "Downloads", downloads); 42 if (_env) { \
44 ENV_SET(NULL, "Music", music); 43 s = getenv(_env); \
45 ENV_SET(NULL, "Pictures", pictures); 44 if (!s) s = home; \
46 ENV_SET("CommonProgramFiles", NULL, pub); 45 } else s = home; \
47 ENV_SET("APPDATA", "Microsoft\\Windows\\Templates", templates); 46 FATAL_SNPRINTF(_meta, "vpath string '%s' truncated - fatal", "%s\\", s); \
48 ENV_SET(NULL, "Videos", videos); 47 (&user)->_meta = _meta;
49 ENV_SET("LOCALAPPDATA", NULL, data); 48
50 ENV_SET("LOCALAPPDATA", "Temp", tmp); 49 ENV_DIR_SET(NULL, "Desktop", desktop);
51 ENV_SET("APPDATA", NULL, config); 50 ENV_DIR_SET(NULL, "Documents", documents);
52 ENV_SET("LOCALAPPDATA", NULL, cache); 51 ENV_DIR_SET(NULL, "Downloads", downloads);
52 ENV_DIR_SET(NULL, "Music", music);
53 ENV_DIR_SET(NULL, "Pictures", pictures);
54 ENV_SET("PUBLIC", pub);
55 ENV_DIR_SET("APPDATA", "Microsoft\\Windows\\Templates", templates);
56 ENV_DIR_SET(NULL, "Videos", videos);
57 ENV_SET("LOCALAPPDATA", data);
58 ENV_DIR_SET("LOCALAPPDATA", "Temp", tmp);
59 ENV_SET("APPDATA", config);
60 ENV_SET("LOCALAPPDATA", cache);
53 if (!(s = getenv("APPDATA"))) 61 if (!(s = getenv("APPDATA")))
54 user.run = NULL; 62 user.run = NULL;
55 else 63 else