Browse Source

Remove arguments to ParseConfigFile

0.14
Matt Corallo 8 years ago
parent
commit
c8042a48f0
  1. 2
      src/bitcoin-cli.cpp
  2. 2
      src/bitcoind.cpp
  3. 2
      src/qt/bitcoin.cpp
  4. 10
      src/util.cpp
  5. 2
      src/util.h

2
src/bitcoin-cli.cpp

@ -99,7 +99,7 @@ static int AppInitRPC(int argc, char* argv[])
return EXIT_FAILURE; return EXIT_FAILURE;
} }
try { try {
ReadConfigFile(GetArg("-conf", BITCOIN_CONF_FILENAME), mapArgs, mapMultiArgs); ReadConfigFile(GetArg("-conf", BITCOIN_CONF_FILENAME));
} catch (const std::exception& e) { } catch (const std::exception& e) {
fprintf(stderr,"Error reading configuration file: %s\n", e.what()); fprintf(stderr,"Error reading configuration file: %s\n", e.what());
return EXIT_FAILURE; return EXIT_FAILURE;

2
src/bitcoind.cpp

@ -104,7 +104,7 @@ bool AppInit(int argc, char* argv[])
} }
try try
{ {
ReadConfigFile(GetArg("-conf", BITCOIN_CONF_FILENAME), mapArgs, mapMultiArgs); ReadConfigFile(GetArg("-conf", BITCOIN_CONF_FILENAME));
} catch (const std::exception& e) { } catch (const std::exception& e) {
fprintf(stderr,"Error reading configuration file: %s\n", e.what()); fprintf(stderr,"Error reading configuration file: %s\n", e.what());
return false; return false;

2
src/qt/bitcoin.cpp

@ -608,7 +608,7 @@ int main(int argc, char *argv[])
return EXIT_FAILURE; return EXIT_FAILURE;
} }
try { try {
ReadConfigFile(GetArg("-conf", BITCOIN_CONF_FILENAME), mapArgs, mapMultiArgs); ReadConfigFile(GetArg("-conf", BITCOIN_CONF_FILENAME));
} catch (const std::exception& e) { } catch (const std::exception& e) {
QMessageBox::critical(0, QObject::tr(PACKAGE_NAME), QMessageBox::critical(0, QObject::tr(PACKAGE_NAME),
QObject::tr("Error: Cannot parse configuration file: %1. Only use key=value syntax.").arg(e.what())); QObject::tr("Error: Cannot parse configuration file: %1. Only use key=value syntax.").arg(e.what()));

10
src/util.cpp

@ -526,9 +526,7 @@ boost::filesystem::path GetConfigFile(const std::string& confPath)
return pathConfigFile; return pathConfigFile;
} }
void ReadConfigFile(const std::string& confPath, void ReadConfigFile(const std::string& confPath)
map<string, string>& mapSettingsRet,
map<string, vector<string> >& mapMultiSettingsRet)
{ {
boost::filesystem::ifstream streamConfig(GetConfigFile(confPath)); boost::filesystem::ifstream streamConfig(GetConfigFile(confPath));
if (!streamConfig.good()) if (!streamConfig.good())
@ -543,9 +541,9 @@ void ReadConfigFile(const std::string& confPath,
string strKey = string("-") + it->string_key; string strKey = string("-") + it->string_key;
string strValue = it->value[0]; string strValue = it->value[0];
InterpretNegativeSetting(strKey, strValue); InterpretNegativeSetting(strKey, strValue);
if (mapSettingsRet.count(strKey) == 0) if (mapArgs.count(strKey) == 0)
mapSettingsRet[strKey] = strValue; mapArgs[strKey] = strValue;
mapMultiSettingsRet[strKey].push_back(strValue); mapMultiArgs[strKey].push_back(strValue);
} }
// If datadir is changed in .conf file: // If datadir is changed in .conf file:
ClearDatadirCache(); ClearDatadirCache();

2
src/util.h

@ -106,7 +106,7 @@ boost::filesystem::path GetConfigFile(const std::string& confPath);
boost::filesystem::path GetPidFile(); boost::filesystem::path GetPidFile();
void CreatePidFile(const boost::filesystem::path &path, pid_t pid); void CreatePidFile(const boost::filesystem::path &path, pid_t pid);
#endif #endif
void ReadConfigFile(const std::string& confPath, std::map<std::string, std::string>& mapSettingsRet, std::map<std::string, std::vector<std::string> >& mapMultiSettingsRet); void ReadConfigFile(const std::string& confPath);
#ifdef WIN32 #ifdef WIN32
boost::filesystem::path GetSpecialFolderPath(int nFolder, bool fCreate = true); boost::filesystem::path GetSpecialFolderPath(int nFolder, bool fCreate = true);
#endif #endif

Loading…
Cancel
Save