mirror of
https://github.com/swaywm/sway.git
synced 2024-11-18 22:19:14 +00:00
commit
2d3bd3c747
|
@ -71,13 +71,21 @@ static const char *search_paths[] = {
|
||||||
};
|
};
|
||||||
|
|
||||||
static char *get_config_path() {
|
static char *get_config_path() {
|
||||||
char *home = strdup(getenv("HOME"));
|
char *home = getenv("HOME");
|
||||||
char *config = strdup(getenv("XDG_CONFIG_HOME"));
|
if (home) {
|
||||||
if (!config) {
|
home = strdup(getenv("HOME"));
|
||||||
const char *def = "/.config/sway";
|
}
|
||||||
|
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);
|
config = malloc(strlen(home) + strlen(def) + 1);
|
||||||
strcpy(config, home);
|
strcpy(config, home);
|
||||||
strcat(config, def);
|
strcat(config, def);
|
||||||
|
} else {
|
||||||
|
home = strdup("");
|
||||||
|
config = strdup("");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set up a temporary config for holding set variables
|
// Set up a temporary config for holding set variables
|
||||||
|
|
Loading…
Reference in a new issue