# HG changeset patch # User Matti Hamalainen # Date 1578213933 -7200 # Node ID 5c3697bfefa3f47393b41be85e2418a50d442513 # Parent 46f0bea942e459f27baaa2ccf909d85a686d4115 Rename TH_DIR_SEPARATOR define to TH_DIR_SEPARATOR_CHR and add new TH_DIR_SEPARATOR_STR which defines an equal string constant. diff -r 46f0bea942e4 -r 5c3697bfefa3 th_file.c --- a/th_file.c Sun Jan 05 10:44:58 2020 +0200 +++ b/th_file.c Sun Jan 05 10:45:33 2020 +0200 @@ -66,12 +66,19 @@ // If XDG is enabled, try the environment variable first if (xdgConfigDir != NULL && strcmp(xdgConfigDir, "")) - return th_strdup_printf("%s%c%s%c", xdgConfigDir, TH_DIR_SEPARATOR, name, TH_DIR_SEPARATOR); + { + return th_strdup_printf("%s%c%s%c", + xdgConfigDir, TH_DIR_SEPARATOR_CHR, + name, TH_DIR_SEPARATOR_CHR); + } else { // Nope, try the obvious alternative char *data = th_get_data_dir(); - char *dir = th_strdup_printf("%s%c%s%c%s%c", data, TH_DIR_SEPARATOR, ".config", TH_DIR_SEPARATOR, name, TH_DIR_SEPARATOR); + char *dir = th_strdup_printf("%s%c%s%c%s%c", + data, TH_DIR_SEPARATOR_CHR, + ".config", TH_DIR_SEPARATOR_CHR, + name, TH_DIR_SEPARATOR_CHR); th_free(data); return dir; } @@ -162,7 +169,7 @@ { // Split foremost path element out for (save = 0, end = start; path[end] != 0; end++) - if (path[end] == TH_DIR_SEPARATOR) + if (path[end] == TH_DIR_SEPARATOR_CHR) { save = path[end]; path[end] = 0; diff -r 46f0bea942e4 -r 5c3697bfefa3 th_file.h --- a/th_file.h Sun Jan 05 10:44:58 2020 +0200 +++ b/th_file.h Sun Jan 05 10:45:33 2020 +0200 @@ -18,9 +18,11 @@ // Platform specific defines #if defined(TH_PLAT_WINDOWS) -# define TH_DIR_SEPARATOR '\\' +# define TH_DIR_SEPARATOR_CHR '\\' +# define TH_DIR_SEPARATOR_STR "\\" #else -# define TH_DIR_SEPARATOR '/' +# define TH_DIR_SEPARATOR_CHR '/' +# define TH_DIR_SEPARATOR_STR "/" #endif