Fix a bug introduced in r1289

If the config dir (<datadir>/configs) didn't exist yet, ZNC didn't bother
creating it and thus failed to do write a config.

Thanks to m4v for testing a nightly and for reporting this bug.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1292 726aef4b-f618-498e-8847-2d620e286838
This commit is contained in:
psychon
2008-12-17 15:36:47 +00:00
parent e493c23243
commit 804b259f69
2 changed files with 12 additions and 2 deletions
+11 -2
View File
@@ -440,6 +440,15 @@ void CZNC::InitDirs(const CString& sArgvPath, const CString& sDataDir) {
}
}
CString CZNC::GetConfPath() const {
CString sConfPath = m_sZNCPath + "/configs/";
if (!CFile::Exists(sConfPath)) {
CDir::MakeDir(sConfPath);
}
return sConfPath;
}
CString CZNC::GetUserPath() const {
CString sUserPath = m_sZNCPath + "/users/";
if (!CFile::Exists(sUserPath)) {
@@ -464,12 +473,12 @@ CString CZNC::ExpandConfigPath(const CString& sConfigFile) {
CString sRetPath;
if (sConfigFile.empty()) {
sRetPath = GetZNCPath() + "/configs/znc.conf";
sRetPath = GetConfPath() + "/znc.conf";
} else {
if (sConfigFile.Left(2) == "./" || sConfigFile.Left(3) == "../") {
sRetPath = GetCurPath() + "/" + sConfigFile;
} else if (sConfigFile.Left(1) != "/") {
sRetPath = GetZNCPath() + "/configs/" + sConfigFile;
sRetPath = GetConfPath() + "/" + sConfigFile;
} else {
sRetPath = sConfigFile;
}