mirror of
https://github.com/xiaozhou233/JuiceAgent.git
synced 2026-12-05 13:05:53 +08:00
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:
1 parent
ff216aabee
commit
dbae5e5258
1 file changed
+7
-3
@@ -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");
|
||||
|
||||
|
||||
Reference in new issue
Block a user