aboutsummaryrefslogtreecommitdiffstats
path: root/src/CommandLine.cxx
diff options
context:
space:
mode:
authorAlexander Gehrke <crater@qwertyuiop.de>2013-08-07 16:08:48 +0200
committerMax Kellermann <max@duempel.org>2013-08-07 18:22:27 +0200
commit87b732846388d3c4a2d755863df4328a6c08041e (patch)
tree7799988e59a800aeb2de278ce9fbfcb5ffe0b361 /src/CommandLine.cxx
parent3f846cf6b86d0b9f0fe500b2a08d67672ed58169 (diff)
downloadmpd-87b732846388d3c4a2d755863df4328a6c08041e.tar.gz
mpd-87b732846388d3c4a2d755863df4328a6c08041e.tar.xz
mpd-87b732846388d3c4a2d755863df4328a6c08041e.zip
CommandLine.cxx: look for config file in XDG_CONFIG_HOME too
Look for "$XDG_CONFIG_HOME/mpd/mpd.conf", similar to where mpd looks for the file under Windows.
Diffstat (limited to 'src/CommandLine.cxx')
-rw-r--r--src/CommandLine.cxx8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/CommandLine.cxx b/src/CommandLine.cxx
index a62ea370e..89575a13f 100644
--- a/src/CommandLine.cxx
+++ b/src/CommandLine.cxx
@@ -54,6 +54,7 @@
#else /* G_OS_WIN32 */
#define USER_CONFIG_FILE_LOCATION1 ".mpdconf"
#define USER_CONFIG_FILE_LOCATION2 ".mpd/mpd.conf"
+#define USER_CONFIG_FILE_LOCATION_XDG "mpd/mpd.conf"
#endif
static GQuark
@@ -219,7 +220,12 @@ parse_cmdline(int argc, char **argv, struct options *options,
return ReadConfigFile(path, error_r);
}
#else /* G_OS_WIN32 */
- Path path = PathBuildChecked(Path::FromUTF8(g_get_home_dir()),
+ Path path = PathBuildChecked(Path::FromUTF8(g_get_user_config_dir()),
+ USER_CONFIG_FILE_LOCATION_XDG);
+ if (!path.IsNull() && FileExists(path))
+ return ReadConfigFile(path, error_r);
+
+ path = PathBuildChecked(Path::FromUTF8(g_get_home_dir()),
USER_CONFIG_FILE_LOCATION1);
if (!path.IsNull() && FileExists(path))
return ReadConfigFile(path, error_r);