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.
This commit is contained in:
Alexander Gehrke
2013-08-07 16:08:48 +02:00
committed by Max Kellermann
parent 3f846cf6b8
commit 87b7328463
4 changed files with 15 additions and 8 deletions

View File

@@ -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);