mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-04-28 11:47:48 +02:00
rework of storing certificates path (#1642)
Signed-off-by: R4SAS <r4sas@i2pmail.org>
This commit is contained in:
parent
d3a49e513c
commit
e8ad7b4f79
5 changed files with 45 additions and 15 deletions
|
@ -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);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue