diff options
-rw-r--r-- | sway/config.c | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/sway/config.c b/sway/config.c index 0c23fad8..18fb69d9 100644 --- a/sway/config.c +++ b/sway/config.c | |||
@@ -379,6 +379,14 @@ bool load_main_config(const char *file, bool is_active, bool validating) { | |||
379 | path = get_config_path(); | 379 | path = get_config_path(); |
380 | } | 380 | } |
381 | 381 | ||
382 | char *real_path = realpath(path, NULL); | ||
383 | if (real_path == NULL) { | ||
384 | sway_log(SWAY_DEBUG, "%s not found.", path); | ||
385 | free(path); | ||
386 | return false; | ||
387 | } | ||
388 | free(path); | ||
389 | |||
382 | struct sway_config *old_config = config; | 390 | struct sway_config *old_config = config; |
383 | config = calloc(1, sizeof(struct sway_config)); | 391 | config = calloc(1, sizeof(struct sway_config)); |
384 | if (!config) { | 392 | if (!config) { |
@@ -401,8 +409,8 @@ bool load_main_config(const char *file, bool is_active, bool validating) { | |||
401 | input_manager_reset_all_inputs(); | 409 | input_manager_reset_all_inputs(); |
402 | } | 410 | } |
403 | 411 | ||
404 | config->current_config_path = path; | 412 | config->current_config_path = real_path; |
405 | list_add(config->config_chain, path); | 413 | list_add(config->config_chain, real_path); |
406 | 414 | ||
407 | config->reading = true; | 415 | config->reading = true; |
408 | 416 | ||
@@ -454,7 +462,7 @@ bool load_main_config(const char *file, bool is_active, bool validating) { | |||
454 | } | 462 | } |
455 | */ | 463 | */ |
456 | 464 | ||
457 | success = success && load_config(path, config, | 465 | success = success && load_config(real_path, config, |
458 | &config->swaynag_config_errors); | 466 | &config->swaynag_config_errors); |
459 | 467 | ||
460 | if (validating) { | 468 | if (validating) { |