diff options
Diffstat (limited to 'sway')
-rw-r--r-- | sway/config.c | 13 |
1 files changed, 2 insertions, 11 deletions
diff --git a/sway/config.c b/sway/config.c index d7b6b693..e91c0c8b 100644 --- a/sway/config.c +++ b/sway/config.c | |||
@@ -352,13 +352,7 @@ static char *config_path(const char *prefix, const char *config_folder) { | |||
352 | if (!prefix || !prefix[0] || !config_folder || !config_folder[0]) { | 352 | if (!prefix || !prefix[0] || !config_folder || !config_folder[0]) { |
353 | return NULL; | 353 | return NULL; |
354 | } | 354 | } |
355 | 355 | return format_str("%s/%s/config", prefix, config_folder); | |
356 | const char *filename = "config"; | ||
357 | |||
358 | size_t size = 3 + strlen(prefix) + strlen(config_folder) + strlen(filename); | ||
359 | char *path = calloc(size, sizeof(char)); | ||
360 | snprintf(path, size, "%s/%s/%s", prefix, config_folder, filename); | ||
361 | return path; | ||
362 | } | 356 | } |
363 | 357 | ||
364 | static char *get_config_path(void) { | 358 | static char *get_config_path(void) { |
@@ -368,10 +362,7 @@ static char *get_config_path(void) { | |||
368 | 362 | ||
369 | const char *config_home = getenv("XDG_CONFIG_HOME"); | 363 | const char *config_home = getenv("XDG_CONFIG_HOME"); |
370 | if ((config_home == NULL || config_home[0] == '\0') && home != NULL) { | 364 | if ((config_home == NULL || config_home[0] == '\0') && home != NULL) { |
371 | size_t size_fallback = 1 + strlen(home) + strlen("/.config"); | 365 | config_home_fallback = format_str("%s/.config", home); |
372 | config_home_fallback = calloc(size_fallback, sizeof(char)); | ||
373 | if (config_home_fallback != NULL) | ||
374 | snprintf(config_home_fallback, size_fallback, "%s/.config", home); | ||
375 | config_home = config_home_fallback; | 366 | config_home = config_home_fallback; |
376 | } | 367 | } |
377 | 368 | ||