merge bitcoin#24266: Avoid buggy std::filesystem:::create_directories() call

This commit is contained in:
Kittywhiskers Van Gogh 2022-02-04 22:53:04 +02:00 committed by pasta
parent b02d5e34ff
commit f4b896ef5f
No known key found for this signature in database
GPG Key ID: 52527BEDABE87984

View File

@ -463,14 +463,18 @@ const fs::path& ArgsManager::GetDataDir(bool net_specific) const
} else {
path = GetDefaultDataDir();
}
if (net_specific)
path /= fs::PathFromString(BaseParams().DataDir());
if (fs::create_directories(path)) {
// This is the first run, create wallets subdirectory too
if (!fs::exists(path)) {
fs::create_directories(path / "wallets");
}
if (net_specific && !BaseParams().DataDir().empty()) {
path /= fs::PathFromString(BaseParams().DataDir());
if (!fs::exists(path)) {
fs::create_directories(path / "wallets");
}
}
path = StripRedundantLastElementsOfPath(path);
return path;
}