mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-04-27 11:17:49 +02:00
* move ReadConfigFile() : i2p::filesystem -> i2p::config * don't export i2p::config::mapArgs outside namespace
This commit is contained in:
parent
6740ec464c
commit
7565843fbe
3 changed files with 22 additions and 23 deletions
40
util.cpp
40
util.cpp
|
@ -124,6 +124,26 @@ namespace config
|
|||
return atoi(mapArgs[strArg].c_str());
|
||||
return nDefault;
|
||||
}
|
||||
|
||||
void ReadConfigFile(boost::filesystem::path path)
|
||||
{
|
||||
boost::filesystem::ifstream streamConfig(path);
|
||||
if (!streamConfig.good())
|
||||
return; // No i2pd.conf file is OK
|
||||
|
||||
std::set<std::string> setOptions;
|
||||
setOptions.insert("*");
|
||||
|
||||
for (boost::program_options::detail::config_file_iterator it(streamConfig, setOptions), end; it != end; ++it)
|
||||
{
|
||||
// Don't overwrite existing settings so command line settings override i2pd.conf
|
||||
std::string strKey = std::string("-") + it->string_key;
|
||||
if (mapArgs.count(strKey) == 0)
|
||||
{
|
||||
mapArgs[strKey] = it->value[0];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
namespace filesystem
|
||||
|
@ -193,26 +213,6 @@ namespace filesystem
|
|||
return pathTunnelsConfigFile;
|
||||
}
|
||||
|
||||
void ReadConfigFile(std::map<std::string, std::string>& mapSettingsRet)
|
||||
{
|
||||
boost::filesystem::ifstream streamConfig(GetConfigFile());
|
||||
if (!streamConfig.good())
|
||||
return; // No i2pd.conf file is OK
|
||||
|
||||
std::set<std::string> setOptions;
|
||||
setOptions.insert("*");
|
||||
|
||||
for (boost::program_options::detail::config_file_iterator it(streamConfig, setOptions), end; it != end; ++it)
|
||||
{
|
||||
// Don't overwrite existing settings so command line settings override i2pd.conf
|
||||
std::string strKey = std::string("-") + it->string_key;
|
||||
if (mapSettingsRet.count(strKey) == 0)
|
||||
{
|
||||
mapSettingsRet[strKey] = it->value[0];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
boost::filesystem::path GetDefaultDataDir()
|
||||
{
|
||||
// Windows < Vista: C:\Documents and Settings\Username\.i2pd
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue