summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMaxime Coste <mawww@kakoune.org>2019-10-10 20:26:27 +1100
committerMaxime Coste <mawww@kakoune.org>2019-10-10 20:26:27 +1100
commit081595fa2f46ff6a5ac80e4fbfd408564ee924af (patch)
tree41fa924c469dd9ea780bb76301f185f7f579b687 /src
parentf2fa260929df58cb4f156f89bdefa5f82c92b9e0 (diff)
Support specifying the user configuration with KAKOUNE_CONFIG_DIR
Fixes #3072 Closes #3081
Diffstat (limited to 'src')
-rw-r--r--src/main.cc9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/main.cc b/src/main.cc
index e725afc5..de2dba2d 100644
--- a/src/main.cc
+++ b/src/main.cc
@@ -123,10 +123,11 @@ String runtime_directory()
String config_directory()
{
- StringView config_home = getenv("XDG_CONFIG_HOME");
- if (config_home.empty())
- return format("{}/.config/kak", homedir());
- return format("{}/kak", config_home);
+ if (StringView kak_cfg_dir = getenv("KAKOUNE_CONFIG_DIR"); not kak_cfg_dir.empty())
+ return kak_cfg_dir.str();
+ if (StringView xdg_cfg_home = getenv("XDG_CONFIG_HOME"); not xdg_cfg_home.empty())
+ return format("{}/kak", xdg_cfg_home);
+ return format("{}/.config/kak", homedir());
}
static const EnvVarDesc builtin_env_vars[] = { {