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:
1 file changed
+8
-4
+8
-4
@@ -443,14 +443,18 @@ const fs::path& ArgsManager::GetDataDir(bool net_specific) const
|
|||||||
} else {
|
} else {
|
||||||
path = GetDefaultDataDir();
|
path = GetDefaultDataDir();
|
||||||
}
|
}
|
||||||
if (net_specific)
|
|
||||||
path /= fs::PathFromString(BaseParams().DataDir());
|
|
||||||
|
|
||||||
if (fs::create_directories(path)) {
|
if (!fs::exists(path)) {
|
||||||
// This is the first run, create wallets subdirectory too
|
|
||||||
fs::create_directories(path / "wallets");
|
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);
|
path = StripRedundantLastElementsOfPath(path);
|
||||||
return path;
|
return path;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user