mirror of
				https://github.com/swaywm/sway.git
				synced 2025-11-03 09:01:43 -05:00 
			
		
		
		
	load_main_config: add realpath to config_chain
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.
This commit is contained in:
		
							parent
							
								
									9b1905acf9
								
							
						
					
					
						commit
						c65057ef8b
					
				
					 1 changed files with 11 additions and 3 deletions
				
			
		| 
						 | 
					@ -379,6 +379,14 @@ bool load_main_config(const char *file, bool is_active, bool validating) {
 | 
				
			||||||
		path = get_config_path();
 | 
							path = get_config_path();
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						char *real_path = realpath(path, NULL);
 | 
				
			||||||
 | 
						if (real_path == NULL) {
 | 
				
			||||||
 | 
							sway_log(SWAY_DEBUG, "%s not found.", path);
 | 
				
			||||||
 | 
							free(path);
 | 
				
			||||||
 | 
							return false;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						free(path);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	struct sway_config *old_config = config;
 | 
						struct sway_config *old_config = config;
 | 
				
			||||||
	config = calloc(1, sizeof(struct sway_config));
 | 
						config = calloc(1, sizeof(struct sway_config));
 | 
				
			||||||
	if (!config) {
 | 
						if (!config) {
 | 
				
			||||||
| 
						 | 
					@ -401,8 +409,8 @@ bool load_main_config(const char *file, bool is_active, bool validating) {
 | 
				
			||||||
		input_manager_reset_all_inputs();
 | 
							input_manager_reset_all_inputs();
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	config->current_config_path = path;
 | 
						config->current_config_path = real_path;
 | 
				
			||||||
	list_add(config->config_chain, path);
 | 
						list_add(config->config_chain, real_path);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	config->reading = true;
 | 
						config->reading = true;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -454,7 +462,7 @@ bool load_main_config(const char *file, bool is_active, bool validating) {
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	*/
 | 
						*/
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	success = success && load_config(path, config,
 | 
						success = success && load_config(real_path, config,
 | 
				
			||||||
			&config->swaynag_config_errors);
 | 
								&config->swaynag_config_errors);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (validating) {
 | 
						if (validating) {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue