Commit 2151e2ea authored by Max Kellermann's avatar Max Kellermann

mapper: check if g_get_user_special_dir() is supported by GLib

g_get_user_special_dir() was introduced with GLib 2.14. Don't use it in older versions.
parent 6139174d
...@@ -51,10 +51,12 @@ void mapper_init(void) ...@@ -51,10 +51,12 @@ void mapper_init(void)
if (music_dir_param != NULL) { if (music_dir_param != NULL) {
music_dir = g_strdup(music_dir_param->value); music_dir = g_strdup(music_dir_param->value);
} else { } else {
#if GLIB_MAJOR_VERSION > 2 || (GLIB_MAJOR_VERSION == 2 && GLIB_MINOR_VERSION >= 14)
music_dir = g_strdup(g_get_user_special_dir(G_USER_DIRECTORY_MUSIC)); music_dir = g_strdup(g_get_user_special_dir(G_USER_DIRECTORY_MUSIC));
if (music_dir == NULL) if (music_dir == NULL)
/* GLib failed to determine the XDG music /* GLib failed to determine the XDG music
directory - abort */ directory - abort */
#endif
g_error("config parameter \"%s\" not found\n", CONF_MUSIC_DIR); g_error("config parameter \"%s\" not found\n", CONF_MUSIC_DIR);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment