Changeset View
Changeset View
Standalone View
Standalone View
src/util/system.cpp
Show First 20 Lines • Show All 981 Lines • ▼ Show 20 Lines | |||||
std::vector<util::SettingsValue> | std::vector<util::SettingsValue> | ||||
ArgsManager::GetSettingsList(const std::string &arg) const { | ArgsManager::GetSettingsList(const std::string &arg) const { | ||||
LOCK(cs_args); | LOCK(cs_args); | ||||
return util::GetSettingsList(m_settings, m_network, SettingName(arg), | return util::GetSettingsList(m_settings, m_network, SettingName(arg), | ||||
!UseDefaultSection(arg)); | !UseDefaultSection(arg)); | ||||
} | } | ||||
void ArgsManager::logArgsPrefix( | |||||
const std::string &prefix, const std::string §ion, | |||||
const std::map<std::string, std::vector<util::SettingsValue>> &args) const { | |||||
std::string section_str = section.empty() ? "" : "[" + section + "] "; | |||||
for (const auto &arg : args) { | |||||
for (const auto &value : arg.second) { | |||||
Optional<unsigned int> flags = GetArgFlags('-' + arg.first); | |||||
if (flags) { | |||||
std::string value_str = | |||||
(*flags & SENSITIVE) ? "****" : value.write(); | |||||
LogPrintf("%s %s%s=%s\n", prefix, section_str, arg.first, | |||||
value_str); | |||||
} | |||||
} | |||||
} | |||||
} | |||||
void ArgsManager::LogArgs() const { | |||||
LOCK(cs_args); | |||||
for (const auto §ion : m_settings.ro_config) { | |||||
logArgsPrefix("Config file arg:", section.first, section.second); | |||||
} | |||||
logArgsPrefix("Command-line arg:", "", m_settings.command_line_options); | |||||
} | |||||
bool RenameOver(fs::path src, fs::path dest) { | bool RenameOver(fs::path src, fs::path dest) { | ||||
#ifdef WIN32 | #ifdef WIN32 | ||||
return MoveFileExA(src.string().c_str(), dest.string().c_str(), | return MoveFileExA(src.string().c_str(), dest.string().c_str(), | ||||
MOVEFILE_REPLACE_EXISTING) != 0; | MOVEFILE_REPLACE_EXISTING) != 0; | ||||
#else | #else | ||||
int rc = std::rename(src.string().c_str(), dest.string().c_str()); | int rc = std::rename(src.string().c_str(), dest.string().c_str()); | ||||
return (rc == 0); | return (rc == 0); | ||||
#endif /* WIN32 */ | #endif /* WIN32 */ | ||||
▲ Show 20 Lines • Show All 278 Lines • Show Last 20 Lines |