MCPcopy Create free account
hub / github.com/LUX-Core/lux / ReadConfigFile

Function ReadConfigFile

src/util.cpp:598–625  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

596}
597
598void ReadConfigFile(map<string, string>& mapSettingsRet,
599 map<string, vector<string> >& mapMultiSettingsRet)
600{
601 boost::filesystem::ifstream streamConfig(GetConfigFile());
602 if (!streamConfig.good()) {
603 // Create empty lux.conf if it does not exist
604 FILE* configFile = fopen(GetConfigFile().string().c_str(), "a");
605 if (configFile != NULL)
606 fclose(configFile);
607 return; // Nothing to read, so just return
608 }
609
610 set<string> setOptions;
611 setOptions.insert("*");
612
613 for (boost::program_options::detail::config_file_iterator it(streamConfig, setOptions), end; it != end; ++it) {
614 // Don't overwrite existing settings so command line settings override lux.conf
615 string strKey = string("-") + it->string_key;
616 if (mapSettingsRet.count(strKey) == 0) {
617 mapSettingsRet[strKey] = it->value[0];
618 // interpret nofoo=1 as foo=0 (and nofoo=0 as foo=1) as long as foo not set)
619 InterpretNegativeSetting(strKey, mapSettingsRet);
620 }
621 mapMultiSettingsRet[strKey].push_back(it->value[0]);
622 }
623 // If datadir is changed in .conf file:
624 ClearDatadirCache();
625}
626
627void WriteConfigToFile(std::string strKey, std::string strValue)
628{

Callers 3

AppInitFunction · 0.85
AppInitRPCFunction · 0.85
mainFunction · 0.85

Calls 6

GetConfigFileFunction · 0.85
InterpretNegativeSettingFunction · 0.85
ClearDatadirCacheFunction · 0.85
insertMethod · 0.45
countMethod · 0.45
push_backMethod · 0.45

Tested by

no test coverage detected