mirror of
https://github.com/znc/znc.git
synced 2026-05-09 06:44:40 +02:00
Do not create empty directories if one does ./znc --datadir=NON_EXISTING_DIR
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1878 726aef4b-f618-498e-8847-2d620e286838
This commit is contained in:
@@ -467,9 +467,9 @@ void CZNC::InitDirs(const CString& sArgvPath, const CString& sDataDir) {
|
||||
}
|
||||
}
|
||||
|
||||
CString CZNC::GetConfPath() const {
|
||||
CString CZNC::GetConfPath(bool bAllowMkDir) const {
|
||||
CString sConfPath = m_sZNCPath + "/configs";
|
||||
if (!CFile::Exists(sConfPath)) {
|
||||
if (bAllowMkDir && !CFile::Exists(sConfPath)) {
|
||||
CDir::MakeDir(sConfPath);
|
||||
}
|
||||
|
||||
@@ -496,16 +496,16 @@ CString CZNC::GetModPath() const {
|
||||
}
|
||||
|
||||
|
||||
CString CZNC::ExpandConfigPath(const CString& sConfigFile) {
|
||||
CString CZNC::ExpandConfigPath(const CString& sConfigFile, bool bAllowMkDir) {
|
||||
CString sRetPath;
|
||||
|
||||
if (sConfigFile.empty()) {
|
||||
sRetPath = GetConfPath() + "/znc.conf";
|
||||
sRetPath = GetConfPath(bAllowMkDir) + "/znc.conf";
|
||||
} else {
|
||||
if (sConfigFile.Left(2) == "./" || sConfigFile.Left(3) == "../") {
|
||||
sRetPath = GetCurPath() + "/" + sConfigFile;
|
||||
} else if (sConfigFile.Left(1) != "/") {
|
||||
sRetPath = GetConfPath() + "/" + sConfigFile;
|
||||
sRetPath = GetConfPath(bAllowMkDir) + "/" + sConfigFile;
|
||||
} else {
|
||||
sRetPath = sConfigFile;
|
||||
}
|
||||
@@ -985,7 +985,7 @@ bool CZNC::ParseConfig(const CString& sConfig)
|
||||
{
|
||||
CString s;
|
||||
|
||||
m_sConfigFile = ExpandConfigPath(sConfig);
|
||||
m_sConfigFile = ExpandConfigPath(sConfig, false);
|
||||
|
||||
return DoRehash(s);
|
||||
}
|
||||
|
||||
@@ -45,7 +45,7 @@ public:
|
||||
bool AllowConnectionFrom(const CString& sIP) const;
|
||||
void InitDirs(const CString& sArgvPath, const CString& sDataDir);
|
||||
bool OnBoot();
|
||||
CString ExpandConfigPath(const CString& sConfigFile);
|
||||
CString ExpandConfigPath(const CString& sConfigFile, bool bAllowMkDir = true);
|
||||
bool WriteNewConfig(const CString& sConfigFile);
|
||||
bool WriteConfig();
|
||||
bool ParseConfig(const CString& sConfig);
|
||||
@@ -97,7 +97,7 @@ public:
|
||||
const CString& GetCurPath() const { if (!CFile::Exists(m_sCurPath)) { CDir::MakeDir(m_sCurPath); } return m_sCurPath; }
|
||||
const CString& GetHomePath() const { if (!CFile::Exists(m_sHomePath)) { CDir::MakeDir(m_sHomePath); } return m_sHomePath; }
|
||||
const CString& GetZNCPath() const { if (!CFile::Exists(m_sZNCPath)) { CDir::MakeDir(m_sZNCPath); } return m_sZNCPath; }
|
||||
CString GetConfPath() const;
|
||||
CString GetConfPath(bool bAllowMkDir = true) const;
|
||||
CString GetUserPath() const;
|
||||
CString GetModPath() const;
|
||||
CString GetPemLocation() const { return GetZNCPath() + "/znc.pem"; }
|
||||
|
||||
Reference in New Issue
Block a user