mirror of
https://github.com/gryf/wmaker.git
synced 2025-12-19 12:28:22 +01:00
util: rewrote path building in makeThemePack
Use a better name for local variable and allocate the (almost) correct number of characters for the path instead of a fixed offset that could be a problem if the constant part of the path were to be updated. Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
This commit is contained in:
committed by
Carlos R. Mafra
parent
d90c8d5370
commit
35b912dd25
@@ -181,6 +181,9 @@ static void findCopyFile(const char *dir, const char *file)
|
|||||||
free(fullPath);
|
free(fullPath);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#define THEME_SUBPATH "/Library/WindowMaker/Themes/"
|
||||||
|
#define THEME_EXTDIR ".themed/"
|
||||||
|
|
||||||
static void makeThemePack(WMPropList * style, const char *themeName)
|
static void makeThemePack(WMPropList * style, const char *themeName)
|
||||||
{
|
{
|
||||||
WMPropList *keys;
|
WMPropList *keys;
|
||||||
@@ -189,13 +192,16 @@ static void makeThemePack(WMPropList * style, const char *themeName)
|
|||||||
int i;
|
int i;
|
||||||
size_t themeNameLen;
|
size_t themeNameLen;
|
||||||
char *themeDir;
|
char *themeDir;
|
||||||
const char *t;
|
const char *user_base;
|
||||||
|
|
||||||
if ((t = wusergnusteppath()) == NULL)
|
user_base = wusergnusteppath();
|
||||||
|
if (user_base == NULL)
|
||||||
return;
|
return;
|
||||||
themeNameLen = strlen(t) + strlen(themeName) + 50;
|
themeNameLen = strlen(user_base) + sizeof(THEME_SUBPATH) + strlen(themeName) + sizeof(THEME_EXTDIR) + 1;
|
||||||
themeDir = wmalloc(themeNameLen);
|
themeDir = wmalloc(themeNameLen);
|
||||||
snprintf(themeDir, themeNameLen, "%s/Library/WindowMaker/Themes/%s.themed/", t, themeName);
|
snprintf(themeDir, themeNameLen,
|
||||||
|
"%s" THEME_SUBPATH "%s" THEME_EXTDIR,
|
||||||
|
user_base, themeName);
|
||||||
ThemePath = themeDir;
|
ThemePath = themeDir;
|
||||||
|
|
||||||
if (!wmkdirhier(themeDir)) {
|
if (!wmkdirhier(themeDir)) {
|
||||||
|
|||||||
Reference in New Issue
Block a user