aboutsummaryrefslogtreecommitdiffstats
path: root/src/Main.cxx
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2014-02-07 22:54:18 +0100
committerMax Kellermann <max@duempel.org>2014-02-07 22:54:18 +0100
commit4b010df99e35e1bc0d893c095f7f1f5bedb524d2 (patch)
tree0e7436a0f5e1b0570ee509b6796453a92cc7edca /src/Main.cxx
parent5e4dd4be9c1f971f293e010b223500d5f941baf3 (diff)
downloadmpd-4b010df99e35e1bc0d893c095f7f1f5bedb524d2.tar.gz
mpd-4b010df99e35e1bc0d893c095f7f1f5bedb524d2.tar.xz
mpd-4b010df99e35e1bc0d893c095f7f1f5bedb524d2.zip
Main: create Storage instance in glue_mapper_init()
Don't use the obsolete Mapper library to create it.
Diffstat (limited to '')
-rw-r--r--src/Main.cxx17
1 files changed, 12 insertions, 5 deletions
diff --git a/src/Main.cxx b/src/Main.cxx
index ebdecbb5d..22e71195a 100644
--- a/src/Main.cxx
+++ b/src/Main.cxx
@@ -145,6 +145,16 @@ glue_mapper_init(Error &error)
if (music_dir.IsNull())
music_dir = GetUserMusicDir();
+#ifdef ENABLE_DATABASE
+ if (!music_dir.IsNull()) {
+ const auto music_dir_utf8 = music_dir.ToUTF8();
+ assert(!music_dir_utf8.empty());
+
+ instance->storage = CreateLocalStorage(music_dir_utf8.c_str(),
+ music_dir);
+ }
+#endif
+
mapper_init(std::move(music_dir), std::move(playlist_dir));
return true;
}
@@ -166,7 +176,7 @@ glue_db_init_and_load(void)
LogWarning(main_domain,
"Found both 'database' and 'db_file' setting - ignoring the latter");
- if (!mapper_has_music_directory()) {
+ if (instance->storage == nullptr) {
if (param != nullptr)
LogDefault(main_domain,
"Found database setting without "
@@ -207,8 +217,6 @@ glue_db_init_and_load(void)
return true;
SimpleDatabase &db = *(SimpleDatabase *)instance->database;
- instance->storage = CreateLocalStorage(mapper_get_music_directory_utf8(),
- mapper_get_music_directory_fs());
instance->update = new UpdateService(*instance->event_loop, db,
*instance->storage,
*instance);
@@ -524,8 +532,7 @@ int mpd_main(int argc, char *argv[])
if (config_get_bool(CONF_AUTO_UPDATE, false)) {
#ifdef ENABLE_INOTIFY
- if (mapper_has_music_directory() &&
- instance->storage != nullptr &&
+ if (instance->storage != nullptr &&
instance->update != nullptr)
mpd_inotify_init(*instance->event_loop,
*instance->storage,