Fix: do not auto-read config when runtime dir is empty

Config no longer falls back to the current working directory when no
runtime directory is specified, so an empty runtime dir leaves the config
invalid instead of silently parsing config.toml from the CWD.
This commit is contained in:
xiaozhou233 committed 2026-08-18 20:11:00 +08:00
1 parent ff216aabee
commit dbae5e5258
1 file changed
+7 -3
+7 -3
View File
@@ -15,9 +15,13 @@ class Config {
public:
explicit Config(const std::filesystem::path& runtime_dir = {})
{
_runtime_dir = runtime_dir.empty()
? std::filesystem::current_path()
: runtime_dir;
_runtime_dir = runtime_dir;
// No runtime directory specified: do not auto-read a config file
// from the current working directory.
if (runtime_dir.empty()) {
return;
}
const auto result = toml::try_parse(_runtime_dir / "config.toml");