Rename EDirUser{Set} wrappers and use then some more

This commit is contained in:
Kim Woelders 2021-01-19 19:39:11 +01:00
parent 503256f99d
commit 932af2b256
8 changed files with 38 additions and 37 deletions

View File

@ -526,7 +526,7 @@ __NORETURN__ void EExit(int exitcode);
#define EDirRoot() ENLIGHTENMENT_ROOT
#define EDirBin() ENLIGHTENMENT_BIN
#define EDirLib() ENLIGHTENMENT_LIB
#define EDirUser() Mode.conf.dir
#define EDirUserConf() Mode.conf.dir
#define EDirUserCache() Mode.conf.cache_dir
#define EGetSavePrefix() Mode.conf.prefix

View File

@ -1,6 +1,6 @@
/*
* Copyright (C) 2000-2007 Carsten Haitzler, Geoff Harrison and various contributors
* Copyright (C) 2004-2020 Kim Woelders
* Copyright (C) 2004-2021 Kim Woelders
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to
@ -869,7 +869,7 @@ BindingsSave(void)
fclose(fs);
_ac_fs = NULL;
Esnprintf(s, sizeof(s), "%s/bindings.cfg", EDirUser());
Esnprintf(s, sizeof(s), "%s/bindings.cfg", EDirUserConf());
E_mv(ss, s);
}

View File

@ -1,6 +1,6 @@
/*
* Copyright (C) 2000-2007 Carsten Haitzler, Geoff Harrison and various contributors
* Copyright (C) 2004-2018 Kim Woelders
* Copyright (C) 2004-2021 Kim Woelders
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to
@ -255,7 +255,7 @@ ConfigFilePreparse(const char *src, const char *dst, const char *themepath)
"%s %s",
EDirBin(), EDirRoot(), themepath, EDirRoot(),
e_wm_version, EDirRoot(), EDirBin(), themepath, variant,
EDirUser(), EDirUserCache(),
EDirUserConf(), EDirUserCache(),
WinGetW(VROOT), WinGetH(VROOT), WinGetW(VROOT), WinGetH(VROOT),
WinGetDepth(VROOT), src, dst);
@ -474,7 +474,7 @@ FindFile(const char *file, const char *themepath, int type)
default:
continue;
case 'U': /* User config */
path = EDirUser();
path = EDirUserConf();
break;
case 'E': /* e16 config */
path = EDirRoot();

View File

@ -56,7 +56,7 @@ __EXPORT__ EMode Mode;
static int EoptGet(int argc, char **argv);
static void EoptHelp(void);
static void ECheckEprog(const char *name);
static void EDirUserSet(const char *dir);
static void EDirUserConfSet(const char *dir);
static void EConfNameSet(const char *dir);
static void EDirUserCacheSet(const char *dir);
static void EDirsSetup(void);
@ -133,7 +133,7 @@ main(int argc, char **argv)
EConfNameSet(str);
str = getenv("ECONFDIR");
if (str)
EDirUserSet(str);
EDirUserConfSet(str);
str = getenv("ECACHEDIR");
if (str)
EDirUserCacheSet(str);
@ -185,7 +185,7 @@ main(int argc, char **argv)
EConfNameSet(eoptarg);
break;
case 'P':
EDirUserSet(eoptarg);
EDirUserConfSet(eoptarg);
break;
case 'Q':
EDirUserCacheSet(eoptarg);
@ -251,7 +251,7 @@ main(int argc, char **argv)
Esetenv("EVERSION", e_wm_version);
Esetenv("EROOT", EDirRoot());
Esetenv("EBIN", EDirBin());
Esetenv("ECONFDIR", EDirUser());
Esetenv("ECONFDIR", EDirUserConf());
Esetenv("ECACHEDIR", EDirUserCache());
Esetenv("ETHEME", Mode.theme.path);
@ -504,7 +504,7 @@ EConfNameSet(const char *name)
}
static void
EDirUserSet(const char *dir)
EDirUserConfSet(const char *dir)
{
EFREE_DUP(Mode.conf.dir, dir);
}
@ -520,7 +520,7 @@ Etmp(char *s)
{
static unsigned int n_calls = 0;
Esnprintf(s, 1024, "%s/TMP_%d_%d", EDirUser(), getpid(), n_calls++);
Esnprintf(s, 1024, "%s/TMP_%d_%d", EDirUserConf(), getpid(), n_calls++);
}
static void
@ -555,11 +555,12 @@ EDirsSetup(void)
EDirCheck(home);
/* Set user config dir if not already set */
cfgdir = Mode.conf.dir;
cfgdir = EDirUserConf();
if (!cfgdir)
{
Esnprintf(s, sizeof(s), "%s/.e16", home);
Mode.conf.dir = cfgdir = Estrdup(s);
EDirUserConfSet(s);
cfgdir = EDirUserConf();
}
if (exists(cfgdir))
@ -579,18 +580,18 @@ EDirsSetup(void)
if (!Mode.conf.cache_dir)
Mode.conf.cache_dir = cfgdir; /* Beware if ever freed */
Esnprintf(s, sizeof(s), "%s/menus", cfgdir);
Esnprintf(s, sizeof(s), "%s/menus", EDirUserConf());
Mode.firsttime = !exists(s);
EDirMake(Mode.conf.dir, "themes");
EDirMake(Mode.conf.dir, "backgrounds");
EDirMake(Mode.conf.dir, "menus");
EDirMake(EDirUserConf(), "themes");
EDirMake(EDirUserConf(), "backgrounds");
EDirMake(EDirUserConf(), "menus");
EDirMake(Mode.conf.cache_dir, "cached");
EDirMake(Mode.conf.cache_dir, "cached/cfg");
EDirMake(Mode.conf.cache_dir, "cached/bgsel");
EDirMake(Mode.conf.cache_dir, "cached/img");
EDirMake(Mode.conf.cache_dir, "cached/pager");
EDirMake(EDirUserCache(), "cached");
EDirMake(EDirUserCache(), "cached/cfg");
EDirMake(EDirUserCache(), "cached/bgsel");
EDirMake(EDirUserCache(), "cached/img");
EDirMake(EDirUserCache(), "cached/pager");
}
/*
@ -606,12 +607,12 @@ ESavePrefixSetup(void)
if (Mode.conf.name)
Esnprintf(buf, sizeof(buf), "%s/%s-%d",
Mode.conf.dir, Mode.conf.name, Dpy.screen);
EDirUserConf(), Mode.conf.name, Dpy.screen);
else if (Mode.wm.window)
Esnprintf(buf, sizeof(buf), "%s/%s-window", Mode.conf.dir, ECFG_DEFAULT);
Esnprintf(buf, sizeof(buf), "%s/%s-window", EDirUserConf(), ECFG_DEFAULT);
else
Esnprintf(buf, sizeof(buf), "%s/%s-%s",
Mode.conf.dir, ECFG_DEFAULT, Dpy.name);
EDirUserConf(), ECFG_DEFAULT, Dpy.name);
Mode.conf.prefix = Estrdup(buf);

View File

@ -1,6 +1,6 @@
/*
* Copyright (C) 2000-2007 Carsten Haitzler, Geoff Harrison and various contributors
* Copyright (C) 2004-2020 Kim Woelders
* Copyright (C) 2004-2021 Kim Woelders
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to
@ -399,7 +399,7 @@ MenuCreateFromBackgrounds(const char *name, MenuStyle * ms)
Menu *m;
char s[FILEPATH_LEN_MAX];
Esnprintf(s, sizeof(s), "%s/backgrounds", EDirUser());
Esnprintf(s, sizeof(s), "%s/backgrounds", EDirUserConf());
m = MenuCreateFromDirectory(name, NULL, ms, s);
if (!m)

View File

@ -1,6 +1,6 @@
/*
* Copyright (C) 2000-2007 Carsten Haitzler, Geoff Harrison and various contributors
* Copyright (C) 2004-2020 Kim Woelders
* Copyright (C) 2004-2021 Kim Woelders
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to
@ -196,13 +196,13 @@ set_save_props(SmcConn smc_conn, int master_flag)
restartVal[n++].value = (char *)"-p";
restartVal[n++].value = (char *)s;
}
s = Mode.conf.dir;
s = EDirUserConf();
if (s)
{
restartVal[n++].value = (char *)"-P";
restartVal[n++].value = (char *)s;
}
s = Mode.conf.cache_dir;
s = EDirUserCache();
if (s)
{
restartVal[n++].value = (char *)"-Q";

View File

@ -1,6 +1,6 @@
/*
* Copyright (C) 2000-2007 Carsten Haitzler, Geoff Harrison and various contributors
* Copyright (C) 2004-2020 Kim Woelders
* Copyright (C) 2004-2021 Kim Woelders
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to
@ -35,7 +35,7 @@ _ThemePathsUpdate(void)
char paths[FILEPATH_LEN_MAX];
Esnprintf(paths, sizeof(paths), "%s/themes:%s/.themes:%s/themes:%s",
EDirUser(), userhome(), EDirRoot(),
EDirUserConf(), userhome(), EDirRoot(),
(Conf.theme.extra_path) ? Conf.theme.extra_path : "");
EFREE_DUP(Mode.theme.paths, paths);
}
@ -159,7 +159,7 @@ _append_merge_dir(char *dir, char ***list, int *count)
if (strcmp(s + 1, "etheme") == 0)
{
Esnprintf(s1, sizeof(s1), "%s/themes/%s", EDirUser(), str[i]);
Esnprintf(s1, sizeof(s1), "%s/themes/%s", EDirUserConf(), str[i]);
s = strrchr(s1, '.');
if (!s)
continue;
@ -246,7 +246,7 @@ _ThemeExtract(const char *path)
Esnprintf(th, sizeof(th), "%s/.themes/%s", userhome(), name);
}
else
Esnprintf(th, sizeof(th), "%s/themes/%s", EDirUser(), name);
Esnprintf(th, sizeof(th), "%s/themes/%s", EDirUserConf(), name);
/* check magic numbers */
if ((buf[0] == 31) && (buf[1] == 139))

View File

@ -1,6 +1,6 @@
/*
* Copyright (C) 2000-2007 Carsten Haitzler, Geoff Harrison and various contributors
* Copyright (C) 2004-2015 Kim Woelders
* Copyright (C) 2004-2021 Kim Woelders
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to
@ -46,7 +46,7 @@ EFonts_Init(void)
imlib_add_path_to_font_path(s);
Esnprintf(s, sizeof(s), "%s/fonts", EDirRoot());
imlib_add_path_to_font_path(s);
Esnprintf(s, sizeof(s), "%s/fonts", Mode.conf.dir);
Esnprintf(s, sizeof(s), "%s/fonts", EDirUserConf());
imlib_add_path_to_font_path(s);
#endif
}