mirror of
https://github.com/znc/znc.git
synced 2026-03-28 17:42:41 +01:00
Added SetFileName()
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@401 726aef4b-f618-498e-8847-2d620e286838
This commit is contained in:
@@ -1,20 +1,7 @@
|
||||
#include "FileUtils.h"
|
||||
|
||||
CFile::CFile(const CString& sLongName) {
|
||||
m_sLongName = sLongName;
|
||||
m_iFD = -1;
|
||||
|
||||
m_sShortName = sLongName;
|
||||
|
||||
// @todo shouldn't this be Right() and RightChomp() ?!
|
||||
while (m_sShortName.Left(1) == "/") {
|
||||
m_sShortName.LeftChomp();
|
||||
}
|
||||
|
||||
CString::size_type uPos = m_sShortName.rfind('/');
|
||||
if (uPos != CString::npos) {
|
||||
m_sShortName = m_sShortName.substr(uPos +1);
|
||||
}
|
||||
SetFileName(sLongName);
|
||||
}
|
||||
|
||||
CFile::~CFile() {
|
||||
@@ -23,6 +10,19 @@ CFile::~CFile() {
|
||||
}
|
||||
}
|
||||
|
||||
void CFile::SetFileName(const CString& sLongName) {
|
||||
m_sLongName = sLongName;
|
||||
m_iFD = -1;
|
||||
|
||||
m_sShortName = sLongName;
|
||||
m_sShortName.RightTrim("/");
|
||||
|
||||
CString::size_type uPos = m_sShortName.rfind('/');
|
||||
if (uPos != CString::npos) {
|
||||
m_sShortName = m_sShortName.substr(uPos +1);
|
||||
}
|
||||
}
|
||||
|
||||
bool CFile::IsReg(const CString& sLongName, bool bUseLstat) { return CFile::FType(sLongName, FT_REGULAR, bUseLstat); }
|
||||
bool CFile::IsDir(const CString& sLongName, bool bUseLstat) { return CFile::FType(sLongName, FT_DIRECTORY, bUseLstat); }
|
||||
bool CFile::IsChr(const CString& sLongName, bool bUseLstat) { return CFile::FType(sLongName, FT_CHARACTER, bUseLstat); }
|
||||
|
||||
Reference in New Issue
Block a user