diff options
author | Max Kellermann <max@musicpd.org> | 2018-07-17 23:27:50 +0200 |
---|---|---|
committer | Max Kellermann <max@musicpd.org> | 2018-07-17 23:27:50 +0200 |
commit | bcc1e51097b0bfac30f2ffb0d81c5b8a7cfd874f (patch) | |
tree | 98293eb961d8ac2dc8c844e59e4176a0a874915c /src/Main.cxx | |
parent | e8a7c6cee33bd591730313fea6909c565d56a0fc (diff) |
StateFile: add struct StateFileConfig
Diffstat (limited to 'src/Main.cxx')
-rw-r--r-- | src/Main.cxx | 22 |
1 files changed, 4 insertions, 18 deletions
diff --git a/src/Main.cxx b/src/Main.cxx index 2932a0741..5c933c4f2 100644 --- a/src/Main.cxx +++ b/src/Main.cxx @@ -93,7 +93,6 @@ #include "java/File.hxx" #include "android/Environment.hxx" #include "android/Context.hxx" -#include "fs/StandardDirectory.hxx" #include "fs/FileSystem.hxx" #include "org_musicpd_Bridge.h" #endif @@ -256,26 +255,13 @@ glue_sticker_init(const ConfigData &config) } static void -glue_state_file_init(const ConfigData &config) +glue_state_file_init(const ConfigData &raw_config) { - auto path_fs = config.GetPath(ConfigOption::STATE_FILE); - if (path_fs.IsNull()) { -#ifdef ANDROID - const auto cache_dir = GetUserCacheDir(); - if (cache_dir.IsNull()) - return; - - path_fs = cache_dir / Path::FromFS("state"); -#else + StateFileConfig config(raw_config); + if (!config.IsEnabled()) return; -#endif - } - - const auto interval = - config.GetUnsigned(ConfigOption::STATE_FILE_INTERVAL, - StateFile::DEFAULT_INTERVAL); - instance->state_file = new StateFile(std::move(path_fs), interval, + instance->state_file = new StateFile(std::move(config), instance->partitions.front(), instance->event_loop); instance->state_file->Read(); |