Skip to content

Commit

Permalink
Utils: Use the constants added in config-paths.h for paths
Browse files Browse the repository at this point in the history
Replace hard-coded directory names by the constants that have been
previously added to the common header.
  • Loading branch information
Christophe CURIS authored and crmafra committed Aug 10, 2021
1 parent fb2a6d2 commit 9f9ef64
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 10 deletions.
10 changes: 6 additions & 4 deletions util/getstyle.c
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,9 @@
#include "../src/wconfig.h"


#define THEME_SUBPATH "/" PACKAGE_TARNAME "/Themes/"
#define THEME_EXTDIR ".themed/"

/* table of style related options */
static char *options[] = {
"TitleJustify",
Expand Down Expand Up @@ -137,7 +140,9 @@ static noreturn void print_help(int print_usage, int exitval)
{
printf("Usage: %s [-t] [-p] [-h] [-v] [file]\n", prog_name);
if (print_usage) {
puts("Retrieves style/theme configuration and outputs to ~/GNUstep/Library/WindowMaker/Themes/file.themed/style or to stdout");
puts("Retrieves style/theme configuration and outputs to "
"~/" GSUSER_SUBDIR "/" USERDATA_SUBDIR THEME_SUBPATH "file" THEME_EXTDIR "style"
" or to stdout");
puts("");
puts(" -h, --help display this help and exit");
puts(" -v, --version output version information and exit");
Expand Down Expand Up @@ -175,9 +180,6 @@ static void findCopyFile(const char *dir, const char *file)
wfree(fullPath);
}

#define THEME_SUBPATH "/" PACKAGE_TARNAME "/Themes/"
#define THEME_EXTDIR ".themed/"

static void makeThemePack(WMPropList * style, const char *themeName)
{
WMPropList *keys;
Expand Down
12 changes: 6 additions & 6 deletions util/wmgenmenu.c
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,9 @@ int main(int argc, char *argv[])
char *tmp, *theme_paths, *style_paths, *icon_paths;

tmp = wstrconcat("-noext ", PKGDATADIR);
theme_paths = wstrconcat(tmp, "/Themes $HOME/GNUstep/Library/WindowMaker/Themes WITH setstyle");
style_paths = wstrconcat(tmp, "/Styles $HOME/GNUstep/Library/WindowMaker/Styles WITH setstyle");
icon_paths = wstrconcat(tmp, "/IconSets $HOME/GNUstep/Library/WindowMaker/IconSets WITH seticons");
theme_paths = wstrconcat(tmp, "/Themes $HOME/" GSUSER_SUBDIR "/" USERDATA_SUBDIR "/" PACKAGE_TARNAME "/Themes WITH setstyle");
style_paths = wstrconcat(tmp, "/Styles $HOME/" GSUSER_SUBDIR "/" USERDATA_SUBDIR "/" PACKAGE_TARNAME "/Styles WITH setstyle");
icon_paths = wstrconcat(tmp, "/IconSets $HOME/" GSUSER_SUBDIR "/" USERDATA_SUBDIR "/" PACKAGE_TARNAME "/IconSets WITH seticons");

struct option longopts[] = {
{ "version", no_argument, NULL, 'v' },
Expand Down Expand Up @@ -245,7 +245,7 @@ int main(int argc, char *argv[])
L3Menu = WMCreatePLArray(
WMCreatePLString(_("Images")),
WMCreatePLString("OPEN_MENU"),
WMCreatePLString("-noext $HOME/GNUstep/Library/WindowMaker/Backgrounds WITH wmsetbg -u -t"),
WMCreatePLString("-noext $HOME/" GSUSER_SUBDIR "/" USERDATA_SUBDIR "/" PACKAGE_TARNAME "/Backgrounds WITH wmsetbg -u -t"),
NULL
);
WMAddToPLArray(L2Menu, L3Menu);
Expand All @@ -265,7 +265,7 @@ int main(int argc, char *argv[])
L2Menu = WMCreatePLArray(
WMCreatePLString(_("Save IconSet")),
WMCreatePLString("SHEXEC"),
WMCreatePLString("geticonset $HOME/GNUstep/Library/WindowMaker/IconSets/"
WMCreatePLString("geticonset $HOME/" GSUSER_SUBDIR "/" USERDATA_SUBDIR "/" PACKAGE_TARNAME "/IconSets/"
"\"%a(IconSet name,Name to save icon set as)\""),
NULL
);
Expand Down Expand Up @@ -503,7 +503,7 @@ noreturn void print_help(int print_usage, int exitval)
{
printf("Usage: %s [-h] [-v]\n", prog_name);
if (print_usage) {
puts("Writes a menu structure usable as ~/GNUstep/Defaults/WMRootMenu to stdout");
puts("Writes a menu structure usable as ~/" GSUSER_SUBDIR "/" USERDATA_SUBDIR "/WMRootMenu to stdout");
puts("");
puts(" -h, --help display this help and exit");
puts(" -v, --version output version information and exit");
Expand Down

0 comments on commit 9f9ef64

Please sign in to comment.