diff options
| author | Brian Ashworth <bosrsf04@gmail.com> | 2019-01-19 02:54:49 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2019-01-19 02:54:49 -0500 |
| commit | 4e72a36edc073e071729fc8d277bede5e077debf (patch) | |
| tree | d4b9292c836062157167ed98c3d756c0fa17b7d6 | |
| parent | 52eeb9fc1e145a121fdbdaab56446ada26367903 (diff) | |
| parent | d98ada0efde854e159b3938737e23a0a8ab69873 (diff) | |
Merge pull request #26 from swaywm/simplify-config-path
Simplify XDG_CONFIG_HOME handling
| -rw-r--r-- | main.c | 15 |
1 files changed, 3 insertions, 12 deletions
@@ -882,18 +882,9 @@ static char *get_config_path(void) { SYSCONFDIR "/swaylock/config", }; - if (!getenv("XDG_CONFIG_HOME")) { - char *home = getenv("HOME"); - char *config_home = malloc(strlen(home) + strlen("/.config") + 1); - if (!config_home) { - swaylock_log(LOG_ERROR, "Unable to allocate $HOME/.config"); - } else { - strcpy(config_home, home); - strcat(config_home, "/.config"); - setenv("XDG_CONFIG_HOME", config_home, 1); - swaylock_log(LOG_DEBUG, "Set XDG_CONFIG_HOME to %s", config_home); - free(config_home); - } + char *config_home = getenv("XDG_CONFIG_HOME"); + if (!config_home || config_home[0] == '\0') { + config_paths[1] = "$HOME/.config/swaylock/config"; } wordexp_t p; |
