mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-04-27 19:27:49 +02:00
Merge 7be9b09ee0
into 6db7c5733d
This commit is contained in:
commit
c6d110e682
5 changed files with 17 additions and 9 deletions
|
@ -32,8 +32,8 @@ namespace config {
|
|||
options_description general("General options");
|
||||
general.add_options()
|
||||
("help", "Show this message")
|
||||
("conf", value<std::string>()->default_value(""), "Path to main i2pd config file (default: try ~/.i2pd/i2pd.conf or /var/lib/i2pd/i2pd.conf)")
|
||||
("tunconf", value<std::string>()->default_value(""), "Path to config with tunnels list and options (default: try ~/.i2pd/tunnels.conf or /var/lib/i2pd/tunnels.conf)")
|
||||
("conf", value<std::string>()->default_value(""), "Path to main i2pd config file (default: try ~/.config/i2pd/i2pd.conf or /var/lib/i2pd/i2pd.conf)")
|
||||
("tunconf", value<std::string>()->default_value(""), "Path to config with tunnels list and options (default: try ~/.config/i2pd/tunnels.conf or /var/lib/i2pd/tunnels.conf)")
|
||||
("pidfile", value<std::string>()->default_value(""), "Path to pidfile (default: ~/i2pd/i2pd.pid or /var/lib/i2pd/i2pd.pid)")
|
||||
("log", value<std::string>()->default_value(""), "Logs destination: stdout, file, syslog (stdout if not set)")
|
||||
("logfile", value<std::string>()->default_value(""), "Path to logfile (stdout if not set, autodetect if daemon)")
|
||||
|
|
|
@ -81,6 +81,14 @@ namespace fs {
|
|||
dataDir = "/var/lib/" + appName;
|
||||
} else if (home != NULL && strlen(home) > 0) {
|
||||
dataDir = std::string(home) + "/." + appName;
|
||||
if (!boost::filesystem::exists(dataDir)) { // backward compatibility
|
||||
char *config_home = getenv("XDG_CONFIG_HOME");
|
||||
if (config_home != NULL && strlen(config_home) > 0) {
|
||||
dataDir = std::string(config_home) + "/" + appName;
|
||||
} else {
|
||||
dataDir = std::string(home) + "/.config/" + appName;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
dataDir = "/tmp/" + appName;
|
||||
}
|
||||
|
@ -90,7 +98,7 @@ namespace fs {
|
|||
|
||||
bool Init() {
|
||||
if (!boost::filesystem::exists(dataDir))
|
||||
boost::filesystem::create_directory(dataDir);
|
||||
boost::filesystem::create_directories(dataDir);
|
||||
std::string destinations = DataDirPath("destinations");
|
||||
if (!boost::filesystem::exists(destinations))
|
||||
boost::filesystem::create_directory(destinations);
|
||||
|
|
|
@ -82,7 +82,7 @@ namespace fs {
|
|||
* Windows < Vista: C:\Documents and Settings\Username\Application Data\i2pd\
|
||||
* Windows >= Vista: C:\Users\Username\AppData\Roaming\i2pd\
|
||||
* Mac: /Library/Application Support/i2pd/ or ~/Library/Application Support/i2pd/
|
||||
* Unix: /var/lib/i2pd/ (system=1) >> ~/.i2pd/ or /tmp/i2pd/
|
||||
* Unix: /var/lib/i2pd/ (system=1) >> ~/.config/i2pd/ or /tmp/i2pd/
|
||||
*/
|
||||
void DetectDataDir(const std::string & cmdline_datadir, bool isService = false);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue