mirror of
https://github.com/gryf/wmaker.git
synced 2025-12-19 04:20:27 +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);
|
||||
}
|
||||
|
||||
#define THEME_SUBPATH "/Library/WindowMaker/Themes/"
|
||||
#define THEME_EXTDIR ".themed/"
|
||||
|
||||
static void makeThemePack(WMPropList * style, const char *themeName)
|
||||
{
|
||||
WMPropList *keys;
|
||||
@@ -189,13 +192,16 @@ static void makeThemePack(WMPropList * style, const char *themeName)
|
||||
int i;
|
||||
size_t themeNameLen;
|
||||
char *themeDir;
|
||||
const char *t;
|
||||
const char *user_base;
|
||||
|
||||
if ((t = wusergnusteppath()) == NULL)
|
||||
user_base = wusergnusteppath();
|
||||
if (user_base == NULL)
|
||||
return;
|
||||
themeNameLen = strlen(t) + strlen(themeName) + 50;
|
||||
themeNameLen = strlen(user_base) + sizeof(THEME_SUBPATH) + strlen(themeName) + sizeof(THEME_EXTDIR) + 1;
|
||||
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;
|
||||
|
||||
if (!wmkdirhier(themeDir)) {
|
||||
|
||||
Reference in New Issue
Block a user