From: Avuton Olrich Date: Fri, 10 Feb 2012 02:51:34 +0000 (-0800) Subject: conf.c: Add windows default config checking X-Git-Tag: release-0.21~31 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=95c1104f7630dbf0a403925a7941b0215f7bf50d;p=ncmpc.git conf.c: Add windows default config checking --- diff --git a/src/conf.c b/src/conf.c index 476c044..f8ccfac 100644 --- a/src/conf.c +++ b/src/conf.c @@ -604,13 +604,38 @@ check_user_conf_dir(void) char * build_user_conf_filename(void) { +#ifdef WIN32 + return g_build_filename(g_get_user_config_dir(), PACKAGE, "ncmpc.conf", NULL); +#else return g_build_filename(g_get_home_dir(), "." PACKAGE, "config", NULL); +#endif } char * build_system_conf_filename(void) { +#ifdef WIN32 + const gchar* const *system_data_dirs; + gchar *pathname = NULL; + + for (system_data_dirs = g_get_system_config_dirs (); *system_data_dirs != NULL; system_data_dirs++) + { + g_message (*system_data_dirs); + pathname = g_build_filename(*system_data_dirs, PACKAGE, "ncmpc.conf", NULL); + if (g_file_test(pathname, G_FILE_TEST_EXISTS)) + { + break; + } + else + { + g_free (pathname); + pathname = NULL; + } + } + return pathname; +#else return g_build_filename(SYSCONFDIR, PACKAGE, "config", NULL); +#endif } char *