diff --git a/NEWS b/NEWS index 5c2c091da..9dbe2ce4c 100644 --- a/NEWS +++ b/NEWS @@ -1,6 +1,7 @@ ver 0.23.11 (not yet released) * database - simple: move default database to ~/.cache/mpd/db from ~/.cache/mpd.db + - simple: default "cache_directory" to ~/.cache/mpd/mounts * macOS: fix build failure "no archive members specified" * Windows - fix crash bug (stack buffer overflow) after I/O errors diff --git a/src/db/Configured.cxx b/src/db/Configured.cxx index fc4e2c328..beaad4bc4 100644 --- a/src/db/Configured.cxx +++ b/src/db/Configured.cxx @@ -24,6 +24,7 @@ #include "config/Param.hxx" #include "config/Block.hxx" #include "fs/AllocatedPath.hxx" +#include "fs/FileSystem.hxx" #include "fs/StandardDirectory.hxx" #include "util/RuntimeError.hxx" @@ -62,6 +63,19 @@ CreateConfiguredDatabase(const ConfigData &config, ConfigBlock block; block.AddBlockParam("path", std::move(db_file_utf8), -1); + + { + const auto mounts_dir = cache_dir + / Path::FromFS(PATH_LITERAL("mounts")); + CreateDirectoryNoThrow(mounts_dir); + + if (auto mounts_dir_utf8 = mounts_dir.ToUTF8(); + !mounts_dir_utf8.empty()) + block.AddBlockParam("cache_directory", + std::move(mounts_dir_utf8), + -1); + } + return DatabaseGlobalInit(main_event_loop, io_event_loop, listener, block); }