mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-06-05 04:31:45 +02:00
Merge bitcoin/bitcoin#24266: util: Avoid buggy std::filesystem:::create_directories() call
b9c113af754540341d9529532fbadb7525168102 util: Avoid buggy std::filesystem:::create_directories() call (Hennadii Stepanov)
Pull request description:
Compiled with some libstdc++ versions (e.g., on Ubuntu 20.04) [`std::filesystem:::create_directories()`](https://en.cppreference.com/w/cpp/filesystem/create_directory) call [fails](https://github.com/bitcoin/bitcoin/issues/24257#issue-1123753243) to handle symbol links properly.
No behavior change in comparison to the [pre-20744](c194293883
) master branch.
Fixes bitcoin/bitcoin#24257.
ACKs for top commit:
ryanofsky:
Code review ACK b9c113af754540341d9529532fbadb7525168102. Nice simplification and fix
MarcoFalke:
review ACK b9c113af754540341d9529532fbadb7525168102 🐬
Tree-SHA512: 79d940cfc1f68d9b0548fb2ab005e90850b54ac0fb3bb2940afd632d56288d92687579a3176bac3fd0ea3d2dae71e26444f8f7bdb87862414c12866ae5e857c4
This commit is contained in:
commit
8edb0416dd
@ -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…
x
Reference in New Issue
Block a user