You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

68 lines
1.7 KiB
C++

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

#pragma once
class AFX_EXT_CLASS CPathUtility
{
public:
CPathUtility(void);
~CPathUtility(void);
/**
* @brief 获取当前执行文件所在目录函数
* @return 返回值格式类似"D:\\WorkPath\\Utility",最后没有'\\'字符
*/
static CString GetModulePath();
/** @brief 获取文件后缀名 */
static CString GetFileExt(const CString& strFileName);
/** @brief 获取文件名称(不包含后缀)*/
static CString GetFileName(const CString& strFileName);
/** @brief 获取文件所在目录 */
static CString GetDir(const CString& strFileName);
/**
* @brief 判断路径是否存在
* @param [in] strPath 路径,可以是文件、文件夹
*/
static BOOL IsExistPath(const CString& strPath);
/** @brief 判断一个文件名是否有效 */
static BOOL IsValidName(const CString& strName);
/**
* @brief 创建一个目录
*/
static BOOL CreateDir(const CString& strDir);
/**
* @brief 重命名目录
* @param [in] strDir 目录名、全路径
* [in] strName 新的目录名、全路径
*/
static BOOL RenameDir(const CString& strDir,const CString& strName);
/**
* @brief 删除目录下的所有目录和文件
* @param [in] strDir 目录名,最后没有'\\'字符
*/
static BOOL DeleteDir(const CString& strDir);
/** @brief 获取当前工作目录的函数 */
static CString GetWorkDir();
/** @brief 设置当前工作目录的函数 */
static void SetWorkDir(const CString& strDir);
/** @brief 返回Windows目录 */
static CString GetWindowsDir();
/** @brief 返回System目录 */
static CString GetSystemDir();
/**
* @brief 选择文件夹函数、不包含最後的'\\'字符
* @param [in][out]strSelectedFolder传入起始选择文件夹
[in] strTitle 文件夹标题
[in] 选择文件夹对话框父类句柄
*/
static BOOL GetFolder(CString& strSelectedFolder,const CString& strTitle, HWND hParentWnd);
};