diff --git a/znc.cpp b/znc.cpp index 74bbe427..38d25fcf 100644 --- a/znc.cpp +++ b/znc.cpp @@ -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; } diff --git a/znc.h b/znc.h index fd4d89e6..32e14955 100644 --- a/znc.h +++ b/znc.h @@ -148,6 +148,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 GetUserPath() const; CString GetModPath() const; CString GetPemLocation() const { return GetZNCPath() + "/znc.pem"; }