Changeset View
Changeset View
Standalone View
Standalone View
src/util/system.cpp
Show First 20 Lines • Show All 988 Lines • ▼ Show 20 Lines | if (stream.good()) { | ||||
// SelectParams()), so manually check for network.includeconf | // SelectParams()), so manually check for network.includeconf | ||||
// args. | // args. | ||||
std::vector<std::string> includeconf_net(GetArgs( | std::vector<std::string> includeconf_net(GetArgs( | ||||
std::string("-") + GetChainName() + ".includeconf")); | std::string("-") + GetChainName() + ".includeconf")); | ||||
includeconf.insert(includeconf.end(), includeconf_net.begin(), | includeconf.insert(includeconf.end(), includeconf_net.begin(), | ||||
includeconf_net.end()); | includeconf_net.end()); | ||||
} | } | ||||
// Remove -includeconf from configuration, so we can warn about | |||||
// recursion later | |||||
{ | |||||
LOCK(cs_args); | |||||
m_config_args.erase("-includeconf"); | |||||
m_config_args.erase(std::string("-") + GetChainName() + | |||||
".includeconf"); | |||||
} | |||||
for (const std::string &to_include : includeconf) { | for (const std::string &to_include : includeconf) { | ||||
fs::ifstream include_config(GetConfigFile(to_include)); | fs::ifstream include_config(GetConfigFile(to_include)); | ||||
if (include_config.good()) { | if (include_config.good()) { | ||||
if (!ReadConfigStream(include_config, error, | if (!ReadConfigStream(include_config, error, | ||||
ignore_invalid_keys)) { | ignore_invalid_keys)) { | ||||
return false; | return false; | ||||
} | } | ||||
LogPrintf("Included configuration file %s\n", | LogPrintf("Included configuration file %s\n", | ||||
to_include.c_str()); | to_include.c_str()); | ||||
} else { | } else { | ||||
fprintf(stderr, "Failed to include configuration file %s\n", | fprintf(stderr, "Failed to include configuration file %s\n", | ||||
to_include.c_str()); | to_include.c_str()); | ||||
} | } | ||||
} | } | ||||
// Warn about recursive -includeconf | |||||
includeconf = GetArgs("-includeconf"); | |||||
{ | |||||
std::vector<std::string> includeconf_net(GetArgs( | |||||
std::string("-") + GetChainName() + ".includeconf")); | |||||
includeconf.insert(includeconf.end(), includeconf_net.begin(), | |||||
includeconf_net.end()); | |||||
} | |||||
for (const std::string &to_include : includeconf) { | |||||
fprintf(stderr, | |||||
"warning: -includeconf cannot be used from included " | |||||
"files; ignoring -includeconf=%s\n", | |||||
to_include.c_str()); | |||||
} | |||||
} | } | ||||
} | } | ||||
// If datadir is changed in .conf file: | // If datadir is changed in .conf file: | ||||
ClearDatadirCache(); | ClearDatadirCache(); | ||||
if (!fs::is_directory(GetDataDir(false))) { | if (!fs::is_directory(GetDataDir(false))) { | ||||
error = strprintf("specified data directory \"%s\" does not exist.", | error = strprintf("specified data directory \"%s\" does not exist.", | ||||
gArgs.GetArg("-datadir", "").c_str()); | gArgs.GetArg("-datadir", "").c_str()); | ||||
▲ Show 20 Lines • Show All 311 Lines • Show Last 20 Lines |