mirror of
https://github.com/znc/znc.git
synced 2026-07-03 16:31:49 +02:00
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:
+9
-2
@@ -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();
|
||||
|
||||
+1
-1
@@ -263,7 +263,7 @@ public:
|
||||
CFile::EFileAttr GetSortAttr() { return m_eSortAttr; }
|
||||
bool IsDescending() { return m_bDesc; }
|
||||
|
||||
static CString ChangeDir(const CString& sPath, const CString& sAdd, const CString& sHomeDir);
|
||||
static CString ChangeDir(const CString& sPath, const CString& sAdd, const CString& sHomeDir = "");
|
||||
static bool MakeDir(const CString& sPath, mode_t iMode = 0700);
|
||||
|
||||
static CString GetCWD() {
|
||||
|
||||
Reference in New Issue
Block a user