diff options
author | Max Kellermann <max@musicpd.org> | 2020-07-06 20:04:35 +0200 |
---|---|---|
committer | Max Kellermann <max@musicpd.org> | 2020-07-06 20:23:41 +0200 |
commit | fe48e5596f9ba0ad93b9995d512b099d324087e3 (patch) | |
tree | 5200716c8cbca999969c4890b79043abdcb450e7 /src/db | |
parent | d7744d2b8e8219e6f9a9fad7eff63c8e5f3a000d (diff) |
command/storage: automatically scan new mounts
Closes https://github.com/MusicPlayerDaemon/MPD/issues/841
Diffstat (limited to 'src/db')
-rw-r--r-- | src/db/plugins/simple/SimpleDatabasePlugin.cxx | 6 | ||||
-rw-r--r-- | src/db/plugins/simple/SimpleDatabasePlugin.hxx | 4 |
2 files changed, 7 insertions, 3 deletions
diff --git a/src/db/plugins/simple/SimpleDatabasePlugin.cxx b/src/db/plugins/simple/SimpleDatabasePlugin.cxx index 5350db6d8..4cae15c02 100644 --- a/src/db/plugins/simple/SimpleDatabasePlugin.cxx +++ b/src/db/plugins/simple/SimpleDatabasePlugin.cxx @@ -428,7 +428,7 @@ IsUnsafeChar(char ch) return !IsSafeChar(ch); } -void +bool SimpleDatabase::Mount(const char *local_uri, const char *storage_uri) { if (cache_path.IsNull()) @@ -447,9 +447,11 @@ SimpleDatabase::Mount(const char *local_uri, const char *storage_uri) compress); db->Open(); - // TODO: update the new database instance? + bool exists = db->FileExists(); Mount(local_uri, std::move(db)); + + return exists; } inline DatabasePtr diff --git a/src/db/plugins/simple/SimpleDatabasePlugin.hxx b/src/db/plugins/simple/SimpleDatabasePlugin.hxx index bdc90f6c1..5e525a999 100644 --- a/src/db/plugins/simple/SimpleDatabasePlugin.hxx +++ b/src/db/plugins/simple/SimpleDatabasePlugin.hxx @@ -103,9 +103,11 @@ public: /** * Throws #std::runtime_error on error. + * + * @return false if the mounted database needs to be updated */ gcc_nonnull_all - void Mount(const char *local_uri, const char *storage_uri); + bool Mount(const char *local_uri, const char *storage_uri); gcc_nonnull_all bool Unmount(const char *uri) noexcept; |