mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-02-02 11:04:00 +01:00
* util.cpp : update Get*ConfigFile() : autodetect configs
This commit is contained in:
parent
415314a90d
commit
7b23d79dc2
30
util.cpp
30
util.cpp
|
@ -124,19 +124,33 @@ namespace filesystem
|
|||
boost::filesystem::path GetConfigFile()
|
||||
{
|
||||
std::string config; i2p::config::GetOption("conf", config);
|
||||
boost::filesystem::path pathConfigFile(config);
|
||||
if (!pathConfigFile.is_complete())
|
||||
pathConfigFile = GetDataDir() / pathConfigFile;
|
||||
return pathConfigFile;
|
||||
if (config != "") {
|
||||
/* config file set with cmdline */
|
||||
boost::filesystem::path path(config);
|
||||
return path;
|
||||
}
|
||||
/* else - try autodetect */
|
||||
boost::filesystem::path path("i2p.conf");
|
||||
path = GetDataDir() / path;
|
||||
if (!boost::filesystem::exists(path))
|
||||
path = ""; /* reset */
|
||||
return path;
|
||||
}
|
||||
|
||||
boost::filesystem::path GetTunnelsConfigFile()
|
||||
{
|
||||
std::string tunconf; i2p::config::GetOption("tunconf", tunconf);
|
||||
boost::filesystem::path pathTunnelsConfigFile(tunconf);
|
||||
if (!pathTunnelsConfigFile.is_complete())
|
||||
pathTunnelsConfigFile = GetDataDir() / pathTunnelsConfigFile;
|
||||
return pathTunnelsConfigFile;
|
||||
if (tunconf != "") {
|
||||
/* config file set with cmdline */
|
||||
boost::filesystem::path path(tunconf);
|
||||
return path;
|
||||
}
|
||||
/* else - try autodetect */
|
||||
boost::filesystem::path path("tunnels.cfg");
|
||||
path = GetDataDir() / path;
|
||||
if (!boost::filesystem::exists(path))
|
||||
path = ""; /* reset */
|
||||
return path;
|
||||
}
|
||||
|
||||
boost::filesystem::path GetDefaultDataDir()
|
||||
|
|
Loading…
Reference in a new issue