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);
}