util, refactor: Use GetPathArg to read "-settings" value

Take advantage of GetPathArg to simplify code slightly.
pull/24306/head
Ryan Ofsky 3 years ago
parent 687e655ae2
commit 5b946edd73

@ -519,12 +519,12 @@ bool ArgsManager::InitSettings(std::string& error)
bool ArgsManager::GetSettingsPath(fs::path* filepath, bool temp) const bool ArgsManager::GetSettingsPath(fs::path* filepath, bool temp) const
{ {
if (IsArgNegated("-settings")) { fs::path settings = GetPathArg("-settings", fs::path{BITCOIN_SETTINGS_FILENAME});
if (settings.empty()) {
return false; return false;
} }
if (filepath) { if (filepath) {
std::string settings = GetArg("-settings", BITCOIN_SETTINGS_FILENAME); *filepath = fsbridge::AbsPathJoin(GetDataDirNet(), temp ? settings + ".tmp" : settings);
*filepath = fsbridge::AbsPathJoin(GetDataDirNet(), fs::PathFromString(temp ? settings + ".tmp" : settings));
} }
return true; return true;
} }

Loading…
Cancel
Save