aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2009-07-15 18:58:19 +0200
committerMax Kellermann <max@duempel.org>2009-07-15 18:58:19 +0200
commitc134adbcbf1197d8f6e17ad30252af947294dbf7 (patch)
tree9150619424e2564c09786db518f656867418cd4a
parent7bc8c7518b088d160f9861cac418d080c3f69531 (diff)
downloadmpd-c134adbcbf1197d8f6e17ad30252af947294dbf7.tar.gz
mpd-c134adbcbf1197d8f6e17ad30252af947294dbf7.tar.xz
mpd-c134adbcbf1197d8f6e17ad30252af947294dbf7.zip
mapper: pass music and playlist directory to mapper_init()
Added another glue function in main().
Diffstat (limited to '')
-rw-r--r--src/main.c18
-rw-r--r--src/mapper.c22
-rw-r--r--src/mapper.h2
3 files changed, 23 insertions, 19 deletions
diff --git a/src/main.c b/src/main.c
index f1eaa08aa..3d0aaabc9 100644
--- a/src/main.c
+++ b/src/main.c
@@ -100,6 +100,22 @@ glue_daemonize_init(const struct options *options)
daemonize_kill();
}
+static void
+glue_mapper_init(void)
+{
+ const char *music_dir, *playlist_dir;
+
+ music_dir = config_get_path(CONF_MUSIC_DIR);
+#if GLIB_CHECK_VERSION(2,14,0)
+ if (music_dir == NULL)
+ music_dir = g_get_user_special_dir(G_USER_DIRECTORY_MUSIC);
+#endif
+
+ playlist_dir = config_get_path(CONF_PLAYLIST_DIR);
+
+ mapper_init(music_dir, playlist_dir);
+}
+
/**
* Returns the database. If this function returns false, this has not
* succeeded, and the caller should create the database after the
@@ -304,7 +320,7 @@ int main(int argc, char *argv[])
event_pipe_register(PIPE_EVENT_IDLE, idle_event_emitted);
path_global_init();
- mapper_init();
+ glue_mapper_init();
initPermissions();
playlist_global_init();
spl_global_init();
diff --git a/src/mapper.c b/src/mapper.c
index aac7c0c48..cec621a43 100644
--- a/src/mapper.c
+++ b/src/mapper.c
@@ -25,7 +25,6 @@
#include "directory.h"
#include "song.h"
#include "path.h"
-#include "conf.h"
#include <glib.h>
@@ -90,24 +89,13 @@ mapper_set_playlist_dir(const char *path)
playlist_dir);
}
-void mapper_init(void)
+void mapper_init(const char *_music_dir, const char *_playlist_dir)
{
- const char *path;
-
- path = config_get_path(CONF_MUSIC_DIR);
- if (path != NULL)
- mapper_set_music_dir(path);
-#if GLIB_CHECK_VERSION(2,14,0)
- else {
- path = g_get_user_special_dir(G_USER_DIRECTORY_MUSIC);
- if (path != NULL)
- mapper_set_music_dir(path);
- }
-#endif
+ if (_music_dir != NULL)
+ mapper_set_music_dir(_music_dir);
- path = config_get_path(CONF_PLAYLIST_DIR);
- if (path != NULL)
- mapper_set_playlist_dir(path);
+ if (_playlist_dir != NULL)
+ mapper_set_playlist_dir(_playlist_dir);
}
void mapper_finish(void)
diff --git a/src/mapper.h b/src/mapper.h
index 2667f1eee..d63243ff7 100644
--- a/src/mapper.h
+++ b/src/mapper.h
@@ -31,7 +31,7 @@
struct directory;
struct song;
-void mapper_init(void);
+void mapper_init(const char *_music_dir, const char *_playlist_dir);
void mapper_finish(void);