1
0
mirror of https://github.com/gryf/wmaker.git synced 2025-12-18 12:00:31 +01:00

Use wuserdatapath() everytime it is applicable

Replace calls to wusergnusteppath() which just append "/Library" by calls
to wuserdatapath().
Take opportunity to replace hardcoded "/WindowMaker" directories with
the existing PACKAGE_TARNAME macro (which comes from autotools).

The choice of 'TARNAME' is because it meant to be used in filename, thus
less likely to have problematic characters than PACKAGE_NAME (meant for
display purpose) and PACKAGE which is there for historical reason.
This commit is contained in:
John D Pell
2021-08-08 09:36:18 +02:00
committed by Carlos R. Mafra
parent 1e45ff2305
commit bd38778bef
6 changed files with 16 additions and 18 deletions

View File

@@ -394,7 +394,7 @@ static WMColorPanel *makeColorPanel(WMScreen * scrPtr, const char *name)
panel->mode = WMWheelModeColorPanel;
panel->lastChanged = 0;
panel->slidersmode = WMRGBModeColorPanel;
panel->configurationPath = wstrconcat(wusergnusteppath(), "/Library/Colors/");
panel->configurationPath = wstrconcat(wuserdatapath(), "/Colors/");
/* Some General Purpose Widgets */
panel->colorWell = WMCreateColorWell(panel->win);

View File

@@ -1828,7 +1828,7 @@ static void createPanel(Panel * p)
char *tmp;
Bool ok = True;
panel->fprefix = wstrconcat(wusergnusteppath(), "/Library/WindowMaker");
panel->fprefix = wstrconcat(wuserdatapath(), "/" PACKAGE_TARNAME);
if (access(panel->fprefix, F_OK) != 0) {
if (mkdir(panel->fprefix, 0755) < 0) {

View File

@@ -650,7 +650,7 @@ static void storeCommandInScript(const char *cmd, const char *line)
umask(permissions);
permissions = (S_IRWXU | S_IRWXG | S_IRWXO) & (~permissions);
path = wstrconcat(wusergnusteppath(), "/Library/WindowMaker/autostart");
path = wstrconcat(wuserdatapath(), "/" PACKAGE_TARNAME "/autostart");
f = fopen(path, "rb");
if (!f) {
@@ -668,7 +668,7 @@ static void storeCommandInScript(const char *cmd, const char *line)
char *tmppath;
FILE *fo;
tmppath = wstrconcat(wusergnusteppath(), "/Library/WindowMaker/autostart.tmp");
tmppath = wstrconcat(wuserdatapath(), "/" PACKAGE_TARNAME "/autostart.tmp");
fo = fopen(tmppath, "wb");
if (!fo) {
werror(_("could not create temporary file %s"), tmppath);

View File

@@ -51,7 +51,7 @@
/**** Global varianebles ****/
#define MOD_MASK wPreferences.modifier_mask
#define CACHE_ICON_PATH "/Library/WindowMaker/CachedPixmaps"
#define CACHE_ICON_PATH "/" PACKAGE_TARNAME "/CachedPixmaps"
#define ICON_BORDER 3
static void miniwindowExpose(WObjDescriptor *desc, XEvent *event);
@@ -424,17 +424,15 @@ static char *get_icon_cache_path(void)
char *path;
int len, ret;
prefix = wusergnusteppath();
len = strlen(prefix) + strlen(CACHE_ICON_PATH) + 2;
path = wmalloc(len);
snprintf(path, len, "%s%s/", prefix, CACHE_ICON_PATH);
prefix = wuserdatapath();
path = wstrconcat(prefix, CACHE_ICON_PATH "/");
/* If the folder exists, exit */
if (access(path, F_OK) == 0)
return path;
/* Create the folder */
ret = wmkdirhier((const char *) path);
ret = wmkdirhier(path);
/* Exit 1 on success, 0 on failure */
if (ret == 1)

View File

@@ -510,7 +510,7 @@ static void execInitScript(void)
{
char *file, *paths;
paths = wstrconcat(wusergnusteppath(), "/Library/WindowMaker");
paths = wstrconcat(wuserdatapath(), "/" PACKAGE_TARNAME);
paths = wstrappend(paths, ":" DEF_CONFIG_PATHS);
file = wfindfile(paths, DEF_INIT_SCRIPT);
@@ -528,7 +528,7 @@ void ExecExitScript(void)
{
char *file, *paths;
paths = wstrconcat(wusergnusteppath(), "/Library/WindowMaker");
paths = wstrconcat(wuserdatapath(), "/" PACKAGE_TARNAME);
paths = wstrappend(paths, ":" DEF_CONFIG_PATHS);
file = wfindfile(paths, DEF_EXIT_SCRIPT);

View File

@@ -175,7 +175,7 @@ static void findCopyFile(const char *dir, const char *file)
wfree(fullPath);
}
#define THEME_SUBPATH "/Library/WindowMaker/Themes/"
#define THEME_SUBPATH "/" PACKAGE_TARNAME "/Themes/"
#define THEME_EXTDIR ".themed/"
static void makeThemePack(WMPropList * style, const char *themeName)
@@ -186,16 +186,16 @@ static void makeThemePack(WMPropList * style, const char *themeName)
int i;
size_t themeNameLen;
char *themeDir;
const char *user_base;
const char *user_library;
user_base = wusergnusteppath();
if (user_base == NULL)
user_library = wuserdatapath();
if (user_library == NULL)
return;
themeNameLen = strlen(user_base) + sizeof(THEME_SUBPATH) + strlen(themeName) + sizeof(THEME_EXTDIR) + 1;
themeNameLen = strlen(user_library) + sizeof(THEME_SUBPATH) + strlen(themeName) + sizeof(THEME_EXTDIR) + 1;
themeDir = wmalloc(themeNameLen);
snprintf(themeDir, themeNameLen,
"%s" THEME_SUBPATH "%s" THEME_EXTDIR,
user_base, themeName);
user_library, themeName);
ThemePath = themeDir;
if (!wmkdirhier(themeDir)) {