utils: avoid using functions too new (only in EFL >=1.21)

This commit is contained in:
Boris Faure 2019-09-08 21:18:53 +02:00
parent 2d7d75ec2b
commit 822bd70afd
1 changed files with 16 additions and 9 deletions

View File

@ -150,8 +150,7 @@ utils_need_scale_wizard(void)
static char path[PATH_MAX] = ""; static char path[PATH_MAX] = "";
struct stat st; struct stat st;
int res; int res;
char *tmp; char *config_xdg = getenv("ELM_CONFIG_DIR_XDG");
Eina_Bool use_xdg_config;
snprintf(path, sizeof(path) -1, "%s/terminology/config/", snprintf(path, sizeof(path) -1, "%s/terminology/config/",
@ -160,14 +159,22 @@ utils_need_scale_wizard(void)
if (res == 0) if (res == 0)
return EINA_FALSE; return EINA_FALSE;
use_xdg_config = (getenv("ELM_CONFIG_DIR_XDG") != NULL); if (config_xdg)
{
if (use_xdg_config) snprintf(path, sizeof(path) - 1,
tmp = eina_vpath_resolve("(:usr.config:)/elementary"); "%s/elementary", config_xdg);
}
else else
tmp = eina_vpath_resolve("(:home:)/" ".elementary"); {
res = stat(tmp, &st); const char *suffix = "/.elementary";
free(tmp); char home[PATH_MAX - strlen(suffix)];
if (!homedir_get(home, sizeof(home)))
return EINA_TRUE;
snprintf(path, sizeof(path) - 1,
"%s%s", home, suffix);
}
res = stat(path, &st);
if (res == 0) if (res == 0)
return EINA_FALSE; return EINA_FALSE;