diff options
author | Max Kellermann <max@duempel.org> | 2014-02-09 07:21:25 +0100 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2014-02-09 08:09:47 +0100 |
commit | 37b68996605dbea3648262d6bd3585f74f71e8b8 (patch) | |
tree | e7374ac8ccbefe7d1f5a9034783d55fa5af67443 /src/Main.cxx | |
parent | 570b12ec1392dc6561b21c7bb8b653eb7a922a01 (diff) |
Main: move code to storage/Configured.cxx
Diffstat (limited to 'src/Main.cxx')
-rw-r--r-- | src/Main.cxx | 32 |
1 files changed, 3 insertions, 29 deletions
diff --git a/src/Main.cxx b/src/Main.cxx index b98f3c24d..3a40f0bb0 100644 --- a/src/Main.cxx +++ b/src/Main.cxx @@ -45,8 +45,6 @@ #include "IOThread.hxx" #include "fs/AllocatedPath.hxx" #include "fs/Config.hxx" -#include "fs/StandardDirectory.hxx" -#include "fs/CheckFile.hxx" #include "playlist/PlaylistRegistry.hxx" #include "zeroconf/ZeroconfGlue.hxx" #include "decoder/DecoderList.hxx" @@ -72,8 +70,7 @@ #include "db/DatabaseGlue.hxx" #include "db/DatabaseSimple.hxx" #include "db/plugins/SimpleDatabasePlugin.hxx" -#include "storage/plugins/LocalStorage.hxx" -#include "storage/Registry.hxx" +#include "storage/Configured.hxx" #endif #ifdef ENABLE_NEIGHBOR_PLUGINS @@ -151,31 +148,8 @@ glue_mapper_init(Error &error) static bool InitStorage(Error &error) { - auto uri = config_get_string(CONF_MUSIC_DIR, nullptr); - if (uri != nullptr && uri_has_scheme(uri)) { - instance->storage = CreateStorageURI(uri, error); - if (instance->storage == nullptr && !error.IsDefined()) - error.Format(config_domain, - "Unrecognized storage URI: %s", uri); - return instance->storage != nullptr; - } - - auto path_fs = config_get_path(CONF_MUSIC_DIR, error); - if (path_fs.IsNull() && error.IsDefined()) - return false; - - if (path_fs.IsNull()) { - path_fs = GetUserMusicDir(); - if (path_fs.IsNull()) - /* no music directory; that's ok */ - return true; - } - - path_fs.ChopSeparators(); - CheckDirectoryReadable(path_fs); - - instance->storage = CreateLocalStorage(path_fs); - return true; + instance->storage = CreateConfiguredStorage(error); + return !error.IsDefined(); } /** |