mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-03-07 06:09:42 +00:00
rework of storing certificates path (#1642)
Signed-off-by: R4SAS <r4sas@i2pmail.org>
This commit is contained in:
@@ -24,6 +24,7 @@ namespace i2p {
|
||||
namespace fs {
|
||||
std::string appName = "i2pd";
|
||||
std::string dataDir = "";
|
||||
std::string certsDir = "";
|
||||
#ifdef _WIN32
|
||||
std::string dirSep = "\\";
|
||||
#else
|
||||
@@ -42,6 +43,10 @@ namespace fs {
|
||||
return dataDir;
|
||||
}
|
||||
|
||||
const std::string & GetCertsDir () {
|
||||
return certsDir;
|
||||
}
|
||||
|
||||
const std::string GetUTF8DataDir () {
|
||||
#ifdef _WIN32
|
||||
boost::filesystem::wpath path (dataDir);
|
||||
@@ -126,6 +131,21 @@ namespace fs {
|
||||
#endif
|
||||
}
|
||||
|
||||
void SetCertsDir(const std::string & cmdline_certsdir) {
|
||||
if (cmdline_certsdir != "")
|
||||
{
|
||||
if (cmdline_certsdir[cmdline_certsdir.length()-1] == '/')
|
||||
certsDir = cmdline_certsdir.substr(0, cmdline_certsdir.size()-1); // strip trailing slash
|
||||
else
|
||||
certsDir = cmdline_certsdir;
|
||||
}
|
||||
else
|
||||
{
|
||||
certsDir = i2p::fs::DataDirPath("certificates");
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
bool Init() {
|
||||
if (!boost::filesystem::exists(dataDir))
|
||||
boost::filesystem::create_directory(dataDir);
|
||||
|
||||
Reference in New Issue
Block a user