summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrian Ashworth <bosrsf04@gmail.com>2019-01-19 02:54:49 -0500
committerGitHub <noreply@github.com>2019-01-19 02:54:49 -0500
commit4e72a36edc073e071729fc8d277bede5e077debf (patch)
treed4b9292c836062157167ed98c3d756c0fa17b7d6
parent52eeb9fc1e145a121fdbdaab56446ada26367903 (diff)
parentd98ada0efde854e159b3938737e23a0a8ab69873 (diff)
Merge pull request #26 from swaywm/simplify-config-path
Simplify XDG_CONFIG_HOME handling
-rw-r--r--main.c15
1 files changed, 3 insertions, 12 deletions
diff --git a/main.c b/main.c
index d3921d5..60f1a96 100644
--- a/main.c
+++ b/main.c
@@ -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;