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:
cflakes
2010-04-04 15:58:04 +00:00
parent e67b07f07a
commit 611e4e6d4e
2 changed files with 8 additions and 8 deletions
+6 -6
View File
@@ -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);
}
+2 -2
View File
@@ -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"; }