Skip to content

Commit 05c8d8c

Browse files
committed
util: Drop no longer needed StripRedundantLastElementsOfPath() function
1 parent 183dbc3 commit 05c8d8c

File tree

1 file changed

+3
-15
lines changed

1 file changed

+3
-15
lines changed

src/util/system.cpp

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -245,19 +245,6 @@ static std::optional<util::SettingsValue> InterpretValue(const KeyInfo& key, con
245245
return value;
246246
}
247247

248-
namespace {
249-
fs::path StripRedundantLastElementsOfPath(const fs::path& path)
250-
{
251-
auto result = path;
252-
while (result.filename().empty() || fs::PathToString(result.filename()) == ".") {
253-
result = result.parent_path();
254-
}
255-
256-
assert(fs::equivalent(result, path.lexically_normal()));
257-
return result;
258-
}
259-
} // namespace
260-
261248
// Define default constructor and destructor that are not inline, so code instantiating this class doesn't need to
262249
// #include class definitions for all members.
263250
// For example, m_settings has an internal dependency on univalue.
@@ -450,15 +437,16 @@ const fs::path& ArgsManager::GetDataDir(bool net_specific) const
450437
} else {
451438
path = GetDefaultDataDir();
452439
}
453-
if (net_specific)
440+
441+
if (net_specific && !BaseParams().DataDir().empty()) {
454442
path /= fs::PathFromString(BaseParams().DataDir());
443+
}
455444

456445
if (fs::create_directories(path)) {
457446
// This is the first run, create wallets subdirectory too
458447
fs::create_directories(path / "wallets");
459448
}
460449

461-
path = StripRedundantLastElementsOfPath(path);
462450
return path;
463451
}
464452

0 commit comments

Comments
 (0)