db/Configured: add default "cache_directory" setting
This commit is contained in:
parent
5d2e80f188
commit
e9f6a3482c
1
NEWS
1
NEWS
|
@ -1,6 +1,7 @@
|
||||||
ver 0.23.11 (not yet released)
|
ver 0.23.11 (not yet released)
|
||||||
* database
|
* database
|
||||||
- simple: move default database to ~/.cache/mpd/db from ~/.cache/mpd.db
|
- 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"
|
* macOS: fix build failure "no archive members specified"
|
||||||
* Windows
|
* Windows
|
||||||
- fix crash bug (stack buffer overflow) after I/O errors
|
- fix crash bug (stack buffer overflow) after I/O errors
|
||||||
|
|
|
@ -24,6 +24,7 @@
|
||||||
#include "config/Param.hxx"
|
#include "config/Param.hxx"
|
||||||
#include "config/Block.hxx"
|
#include "config/Block.hxx"
|
||||||
#include "fs/AllocatedPath.hxx"
|
#include "fs/AllocatedPath.hxx"
|
||||||
|
#include "fs/FileSystem.hxx"
|
||||||
#include "fs/StandardDirectory.hxx"
|
#include "fs/StandardDirectory.hxx"
|
||||||
#include "util/RuntimeError.hxx"
|
#include "util/RuntimeError.hxx"
|
||||||
|
|
||||||
|
@ -62,6 +63,19 @@ CreateConfiguredDatabase(const ConfigData &config,
|
||||||
|
|
||||||
ConfigBlock block;
|
ConfigBlock block;
|
||||||
block.AddBlockParam("path", std::move(db_file_utf8), -1);
|
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,
|
return DatabaseGlobalInit(main_event_loop, io_event_loop,
|
||||||
listener, block);
|
listener, block);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue