command/storage: automatically scan new mounts

Closes https://github.com/MusicPlayerDaemon/MPD/issues/841
This commit is contained in:
Max Kellermann
2020-07-06 20:04:35 +02:00
parent d7744d2b8e
commit fe48e5596f
4 changed files with 18 additions and 4 deletions

View File

@@ -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

View File

@@ -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;