Skip to content

Commit

Permalink
merge bitcoin#24266: Avoid buggy std::filesystem:::create_directories…
Browse files Browse the repository at this point in the history
…() call
  • Loading branch information
kwvg authored and PastaPastaPasta committed Aug 13, 2024
1 parent b02d5e3 commit f4b896e
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/util/system.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit f4b896e

Please sign in to comment.