|
|
|
|
|
|
|
|
|
|
|
//////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
//<2F>ļ<EFBFBD> SplitPath.h
|
|
|
|
|
|
//<2F><>Ҫ<EFBFBD><D2AA><EFBFBD><EFBFBD>:
|
|
|
|
|
|
//
|
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>д: 2005-12-07
|
|
|
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
|
|
|
|
#ifndef __SPLITPATH_H
|
|
|
|
|
|
#define __SPLITPATH_H
|
|
|
|
|
|
|
|
|
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
// CSplitPath class
|
|
|
|
|
|
|
|
|
|
|
|
class AFX_EXT_CLASS CSplitPath
|
|
|
|
|
|
{
|
|
|
|
|
|
// Construction / destruction
|
|
|
|
|
|
public:
|
|
|
|
|
|
// Constructs a CSplitPath object.
|
|
|
|
|
|
CSplitPath(LPCTSTR lpszPathBuffer=NULL);
|
|
|
|
|
|
|
|
|
|
|
|
// Destroys a CSplitPath object, handles cleanup and de-allocation.
|
|
|
|
|
|
virtual ~CSplitPath();
|
|
|
|
|
|
|
|
|
|
|
|
// Member variables
|
|
|
|
|
|
protected:
|
|
|
|
|
|
TCHAR m_szDrive[_MAX_DRIVE];
|
|
|
|
|
|
TCHAR m_szDir[_MAX_DIR];
|
|
|
|
|
|
TCHAR m_szFName[_MAX_FNAME];
|
|
|
|
|
|
TCHAR m_szExt[_MAX_EXT];
|
|
|
|
|
|
CString m_strSource;
|
|
|
|
|
|
|
|
|
|
|
|
// Member functions
|
|
|
|
|
|
public:
|
|
|
|
|
|
void SplitPath(LPCTSTR lpszPathBuffer);
|
|
|
|
|
|
CString GetDrive() const;
|
|
|
|
|
|
CString GetDir() const;
|
|
|
|
|
|
CString GetName() const;
|
|
|
|
|
|
CString GetExtension() const;
|
|
|
|
|
|
CString GetPath() const;
|
|
|
|
|
|
CString GetFullName() const;
|
|
|
|
|
|
CString GetPathName() const;
|
|
|
|
|
|
BOOL SetModuleFileName(void); //<2F><><EFBFBD><EFBFBD>GetModuleFileName<6D><65><EFBFBD><EFBFBD><EFBFBD>õ<EFBFBD><C3B5>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
|
BOOL SetTempPathFileName(LPCTSTR lpPrefixString = _T("NEW")); //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱĿ¼<C4BF><C2BC>ʱ<EFBFBD>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
|
BOOL IsExist(void);
|
|
|
|
|
|
|
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ..\ <20><> .\ ·<><C2B7>ת<EFBFBD><D7AA>Ϊ<EFBFBD><CEAA><EFBFBD><EFBFBD>·<EFBFBD><C2B7>
|
|
|
|
|
|
CString GetAbsolutePath(LPCTSTR lpszPath); //<2F><><EFBFBD>þ<EFBFBD><C3BE><EFBFBD>·<EFBFBD><C2B7> <20><><EFBFBD>Ե<EFBFBD>ǰģ<C7B0><C4A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD>·<EFBFBD><C2B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
|
CString GetRelativePath(LPCTSTR lpszPath); //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>·<EFBFBD><C2B7>
|
|
|
|
|
|
BOOL MakeDirectory(CString dd); //<2F><><EFBFBD><EFBFBD><EFBFBD>༶Ŀ¼
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
|
|
|
|
AFX_INLINE CString CSplitPath::GetDrive() const {
|
|
|
|
|
|
return CString(m_szDrive);
|
|
|
|
|
|
}
|
|
|
|
|
|
AFX_INLINE CString CSplitPath::GetDir() const {
|
|
|
|
|
|
return CString(m_szDir);
|
|
|
|
|
|
}
|
|
|
|
|
|
AFX_INLINE CString CSplitPath::GetName() const {
|
|
|
|
|
|
return CString(m_szFName);
|
|
|
|
|
|
}
|
|
|
|
|
|
AFX_INLINE CString CSplitPath::GetExtension() const {
|
|
|
|
|
|
return CString(m_szExt);
|
|
|
|
|
|
}
|
|
|
|
|
|
AFX_INLINE CString CSplitPath::GetPath() const {
|
|
|
|
|
|
return GetDrive() + GetDir();
|
|
|
|
|
|
}
|
|
|
|
|
|
AFX_INLINE CString CSplitPath::GetFullName() const {
|
|
|
|
|
|
return GetName() + GetExtension();
|
|
|
|
|
|
}
|
|
|
|
|
|
AFX_INLINE CString CSplitPath::GetPathName() const {
|
|
|
|
|
|
return m_strSource;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
|
|
|
|
#endif // __SPLITPATH_H
|
|
|
|
|
|
|