mapper: fall back to XDG music directory
If no music_directory is configured, fall back to the XDG music directory, determined by g_get_user_special_dir(G_USER_DIRECTORY_MUSIC).
This commit is contained in:
parent
46aedbae09
commit
886ed1b225
1
NEWS
1
NEWS
|
@ -8,6 +8,7 @@ ver 0.15 - (200?/??/??)
|
||||||
* the option "error_file" was removed, all messages are logged into
|
* the option "error_file" was removed, all messages are logged into
|
||||||
"log_file"
|
"log_file"
|
||||||
* support logging to syslog
|
* support logging to syslog
|
||||||
|
* fall back to XDG music directory if no music_directory is configured
|
||||||
|
|
||||||
ver 0.14 (2008/12/25)
|
ver 0.14 (2008/12/25)
|
||||||
* audio outputs:
|
* audio outputs:
|
||||||
|
|
12
src/mapper.c
12
src/mapper.c
|
@ -43,11 +43,21 @@ static size_t playlist_dir_length;
|
||||||
|
|
||||||
void mapper_init(void)
|
void mapper_init(void)
|
||||||
{
|
{
|
||||||
ConfigParam *music_dir_param = parseConfigFilePath(CONF_MUSIC_DIR, 1);
|
ConfigParam *music_dir_param = parseConfigFilePath(CONF_MUSIC_DIR, false);
|
||||||
ConfigParam *playlist_dir_param = parseConfigFilePath(CONF_PLAYLIST_DIR, 1);
|
ConfigParam *playlist_dir_param = parseConfigFilePath(CONF_PLAYLIST_DIR, 1);
|
||||||
int ret;
|
int ret;
|
||||||
struct stat st;
|
struct stat st;
|
||||||
|
|
||||||
|
if (music_dir_param != NULL) {
|
||||||
|
music_dir = g_strdup(music_dir_param->value);
|
||||||
|
} else {
|
||||||
|
music_dir = g_strdup(g_get_user_special_dir(G_USER_DIRECTORY_MUSIC));
|
||||||
|
if (music_dir == NULL)
|
||||||
|
/* GLib failed to determine the XDG music
|
||||||
|
directory - abort */
|
||||||
|
g_error("config parameter \"%s\" not found\n", CONF_MUSIC_DIR);
|
||||||
|
}
|
||||||
|
|
||||||
music_dir = g_strdup(music_dir_param->value);
|
music_dir = g_strdup(music_dir_param->value);
|
||||||
music_dir_length = strlen(music_dir);
|
music_dir_length = strlen(music_dir);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue