mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-02-08 22:13:48 +01:00
* util.cpp : update Get*ConfigFile() : autodetect configs
This commit is contained in:
parent
415314a90d
commit
7b23d79dc2
1 changed files with 22 additions and 8 deletions
30
util.cpp
30
util.cpp
|
@ -124,19 +124,33 @@ namespace filesystem
|
||||||
boost::filesystem::path GetConfigFile()
|
boost::filesystem::path GetConfigFile()
|
||||||
{
|
{
|
||||||
std::string config; i2p::config::GetOption("conf", config);
|
std::string config; i2p::config::GetOption("conf", config);
|
||||||
boost::filesystem::path pathConfigFile(config);
|
if (config != "") {
|
||||||
if (!pathConfigFile.is_complete())
|
/* config file set with cmdline */
|
||||||
pathConfigFile = GetDataDir() / pathConfigFile;
|
boost::filesystem::path path(config);
|
||||||
return pathConfigFile;
|
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()
|
boost::filesystem::path GetTunnelsConfigFile()
|
||||||
{
|
{
|
||||||
std::string tunconf; i2p::config::GetOption("tunconf", tunconf);
|
std::string tunconf; i2p::config::GetOption("tunconf", tunconf);
|
||||||
boost::filesystem::path pathTunnelsConfigFile(tunconf);
|
if (tunconf != "") {
|
||||||
if (!pathTunnelsConfigFile.is_complete())
|
/* config file set with cmdline */
|
||||||
pathTunnelsConfigFile = GetDataDir() / pathTunnelsConfigFile;
|
boost::filesystem::path path(tunconf);
|
||||||
return pathTunnelsConfigFile;
|
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()
|
boost::filesystem::path GetDefaultDataDir()
|
||||||
|
|
Loading…
Add table
Reference in a new issue