Made home dir optional in CDir::ChangeDir() and have it default to CZNC::Get().GetHomePath()

git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1536 726aef4b-f618-498e-8847-2d620e286838
This commit is contained in:
prozacx
2009-06-09 00:25:20 +00:00
parent 2206e19ad2
commit 00613bc90f
2 changed files with 10 additions and 3 deletions

View File

@@ -7,6 +7,7 @@
*/
#include "FileUtils.h"
#include "znc.h"
#include "Utils.h"
#include <sys/stat.h>
#include <sys/types.h>
@@ -420,12 +421,18 @@ CString CFile::GetDir() const {
return sDir;
}
CString CDir::ChangeDir(const CString& sPath, const CString& sAdd, const CString& sHomeDir) {
CString CDir::ChangeDir(const CString& sPath, const CString& sAdd, const CString& sHome) {
CString sHomeDir(sHome);
if (sHomeDir.empty()) {
sHomeDir = CZNC::Get().GetHomePath();
}
if (sAdd == "~") {
return sHomeDir;
}
CString sAddDir = sAdd;
CString sAddDir(sAdd);
if (sAddDir.Left(2) == "~/") {
sAddDir.LeftChomp();