mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-02-22 15:04:44 +01:00
util: Avoid buggy std::filesystem:::create_directories() call
Compiled with some libstdc++ versions (e.g., on Ubuntu 20.04) std::filesystem:::create_directories() call fails to handle symbol links properly.
This commit is contained in:
parent
b2a8371913
commit
b9c113af75
1 changed files with 8 additions and 4 deletions
|
@ -443,14 +443,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;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue