diff options
author | Eelco Dolstra <edolstra@gmail.com> | 2017-04-20 14:58:16 +0200 |
---|---|---|
committer | Eelco Dolstra <edolstra@gmail.com> | 2017-04-20 14:58:16 +0200 |
commit | f05d5f89ff4ec52ed2f6d576b2b2323b5292f815 (patch) | |
tree | 86912765d3dbe77b0e810ad3169dc364015fa71a /src/libutil/util.cc | |
parent | 562585e901d9e5f2ef62be11c2e74badcacb1f50 (diff) |
Read per-user settings from ~/.config/nix/nix.conf
Diffstat (limited to 'src/libutil/util.cc')
-rw-r--r-- | src/libutil/util.cc | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/libutil/util.cc b/src/libutil/util.cc index 0bd51afd1..37dfccd06 100644 --- a/src/libutil/util.cc +++ b/src/libutil/util.cc @@ -429,6 +429,18 @@ Path getCacheDir() } +Path getConfigDir() +{ + Path configDir = getEnv("XDG_CONFIG_HOME"); + if (configDir.empty()) { + Path homeDir = getEnv("HOME"); + if (homeDir.empty()) throw Error("$XDG_CONFIG_HOME and $HOME are not set"); + configDir = homeDir + "/.config"; + } + return configDir; +} + + Paths createDirs(const Path & path) { Paths created; |