aboutsummaryrefslogtreecommitdiffstats
path: root/sway/config.c
diff options
context:
space:
mode:
authorLibravatar Brian Ashworth <bosrsf04@gmail.com>2019-02-07 02:16:38 -0500
committerLibravatar emersion <contact@emersion.fr>2019-02-07 09:41:05 +0100
commit5a32a74b2d0e4685527bd78d5052aafe2df4b8f2 (patch)
treecab7212e3b0f6e3ec395b03194b5b4d20cdf04bf /sway/config.c
parentClarify error for options and positional args (diff)
downloadsway-5a32a74b2d0e4685527bd78d5052aafe2df4b8f2.tar.gz
sway-5a32a74b2d0e4685527bd78d5052aafe2df4b8f2.tar.zst
sway-5a32a74b2d0e4685527bd78d5052aafe2df4b8f2.zip
load_main_config: use given path, store realpath
Since `load_include_config` compares against the realpath of a config file when checking if a config has already been added, the main config's realpath has to be added to the config_chain. However, includes from the main config should be processed relative to the path given to allow for symbolic links. This stores the realpath in `config->config_chain`, but uses the given path for all other operations.
Diffstat (limited to 'sway/config.c')
-rw-r--r--sway/config.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/sway/config.c b/sway/config.c
index 9072f7d7..0c791a35 100644
--- a/sway/config.c
+++ b/sway/config.c
@@ -385,7 +385,6 @@ bool load_main_config(const char *file, bool is_active, bool validating) {
385 free(path); 385 free(path);
386 return false; 386 return false;
387 } 387 }
388 free(path);
389 388
390 struct sway_config *old_config = config; 389 struct sway_config *old_config = config;
391 config = calloc(1, sizeof(struct sway_config)); 390 config = calloc(1, sizeof(struct sway_config));
@@ -409,7 +408,7 @@ bool load_main_config(const char *file, bool is_active, bool validating) {
409 input_manager_reset_all_inputs(); 408 input_manager_reset_all_inputs();
410 } 409 }
411 410
412 config->current_config_path = real_path; 411 config->current_config_path = path;
413 list_add(config->config_chain, real_path); 412 list_add(config->config_chain, real_path);
414 413
415 config->reading = true; 414 config->reading = true;
@@ -462,7 +461,7 @@ bool load_main_config(const char *file, bool is_active, bool validating) {
462 } 461 }
463 */ 462 */
464 463
465 success = success && load_config(real_path, config, 464 success = success && load_config(path, config,
466 &config->swaynag_config_errors); 465 &config->swaynag_config_errors);
467 466
468 if (validating) { 467 if (validating) {