summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBoris Faure <billiob@gmail.com>2019-09-08 21:18:53 +0200
committerBoris Faure <billiob@gmail.com>2019-09-08 21:18:53 +0200
commit822bd70afdb16f9354a4353ebcffba67f8ef5e31 (patch)
tree6236fdc48d89460313c3437052de9191e6bef6af
parent2d7d75ec2b856bc43fdb68bab59f3a1b59e7e24e (diff)
utils: avoid using functions too new (only in EFL >=1.21)
-rw-r--r--src/bin/utils.c25
1 files changed, 16 insertions, 9 deletions
diff --git a/src/bin/utils.c b/src/bin/utils.c
index fddb016..9232676 100644
--- a/src/bin/utils.c
+++ b/src/bin/utils.c
@@ -150,8 +150,7 @@ utils_need_scale_wizard(void)
150 static char path[PATH_MAX] = ""; 150 static char path[PATH_MAX] = "";
151 struct stat st; 151 struct stat st;
152 int res; 152 int res;
153 char *tmp; 153 char *config_xdg = getenv("ELM_CONFIG_DIR_XDG");
154 Eina_Bool use_xdg_config;
155 154
156 155
157 snprintf(path, sizeof(path) -1, "%s/terminology/config/", 156 snprintf(path, sizeof(path) -1, "%s/terminology/config/",
@@ -160,14 +159,22 @@ utils_need_scale_wizard(void)
160 if (res == 0) 159 if (res == 0)
161 return EINA_FALSE; 160 return EINA_FALSE;
162 161
163 use_xdg_config = (getenv("ELM_CONFIG_DIR_XDG") != NULL); 162 if (config_xdg)
164 163 {
165 if (use_xdg_config) 164 snprintf(path, sizeof(path) - 1,
166 tmp = eina_vpath_resolve("(:usr.config:)/elementary"); 165 "%s/elementary", config_xdg);
166 }
167 else 167 else
168 tmp = eina_vpath_resolve("(:home:)/" ".elementary"); 168 {
169 res = stat(tmp, &st); 169 const char *suffix = "/.elementary";
170 free(tmp); 170 char home[PATH_MAX - strlen(suffix)];
171
172 if (!homedir_get(home, sizeof(home)))
173 return EINA_TRUE;
174 snprintf(path, sizeof(path) - 1,
175 "%s%s", home, suffix);
176 }
177 res = stat(path, &st);
171 if (res == 0) 178 if (res == 0)
172 return EINA_FALSE; 179 return EINA_FALSE;
173 180