aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/util/system.cpp12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/util/system.cpp b/src/util/system.cpp
index 0ee63f6381..d51ba07d94 100644
--- a/src/util/system.cpp
+++ b/src/util/system.cpp
@@ -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;
}