# HG changeset patch # User Matti Hamalainen # Date 1670974311 -7200 # Node ID caeb0a44ebdff9a36f352d2b2f51ba53c7d0b179 # Parent 32dab9b6058aadcf70e9e2b1fa92615c982a6a5f Change th_get_config_dir() API. diff -r 32dab9b6058a -r caeb0a44ebdf th_file.c --- a/th_file.c Wed Dec 14 01:31:25 2022 +0200 +++ b/th_file.c Wed Dec 14 01:31:51 2022 +0200 @@ -55,11 +55,10 @@ } -char * th_get_config_dir(const char *name) +char * th_get_config_dir(void) { #if defined(TH_PLAT_WINDOWS) // For Windows, we just use the appdata directory - (void) name; return th_get_data_dir(); #elif defined(USE_XDG) const char *xdgConfigDir = getenv("XDG_CONFIG_HOME"); @@ -67,24 +66,21 @@ // 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_CHR, - name, TH_DIR_SEPARATOR_CHR); + return th_strdup_printf("%s%c", + xdgConfigDir, 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", + char *dir = th_strdup_printf("%s%c%s%c", data, TH_DIR_SEPARATOR_CHR, - ".config", TH_DIR_SEPARATOR_CHR, - name, TH_DIR_SEPARATOR_CHR); + ".config", TH_DIR_SEPARATOR_CHR); th_free(data); return dir; } #else // XDG not enabled - (void) name; return th_get_data_dir(); #endif } diff -r 32dab9b6058a -r caeb0a44ebdf th_file.h --- a/th_file.h Wed Dec 14 01:31:25 2022 +0200 +++ b/th_file.h Wed Dec 14 01:31:51 2022 +0200 @@ -46,7 +46,7 @@ char * th_get_home_dir(void); -char * th_get_config_dir(const char *name); +char * th_get_config_dir(void); bool th_stat_path(const char *path, th_stat_data *data); bool th_mkdir_path(const char *path, const int mode);