mirror of
				https://github.com/swaywm/sway.git
				synced 2025-11-03 09:01:43 -05:00 
			
		
		
		
	Fixed config loading
This commit is contained in:
		
							parent
							
								
									0f29f04816
								
							
						
					
					
						commit
						0e4df85ba1
					
				
					 1 changed files with 12 additions and 4 deletions
				
			
		| 
						 | 
				
			
			@ -71,13 +71,21 @@ static const char *search_paths[] = {
 | 
			
		|||
};
 | 
			
		||||
 | 
			
		||||
static char *get_config_path() {
 | 
			
		||||
	char *home = strdup(getenv("HOME"));
 | 
			
		||||
	char *config = strdup(getenv("XDG_CONFIG_HOME"));
 | 
			
		||||
	if (!config) {
 | 
			
		||||
		const char *def = "/.config/sway";
 | 
			
		||||
	char *home = getenv("HOME");
 | 
			
		||||
	if (home) {
 | 
			
		||||
		home = strdup(getenv("HOME"));
 | 
			
		||||
	}
 | 
			
		||||
	char *config = getenv("XDG_CONFIG_HOME");
 | 
			
		||||
	if (config) {
 | 
			
		||||
		config = strdup(getenv("XDG_CONFIG_HOME"));
 | 
			
		||||
	} else if (home) {
 | 
			
		||||
		const char *def = "/.config";
 | 
			
		||||
		config = malloc(strlen(home) + strlen(def) + 1);
 | 
			
		||||
		strcpy(config, home);
 | 
			
		||||
		strcat(config, def);
 | 
			
		||||
	} else {
 | 
			
		||||
		home = strdup("");
 | 
			
		||||
		config = strdup("");
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	// Set up a temporary config for holding set variables
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue