BOOL CPubFunc::FileExist(CString FileName)
{
CFileFind fFind;
return fFind.FindFile(FileName);
}
BOOL CPubFunc::DirectoryExist(CString Path)
{
WIN32_FIND_DATA fd;
BOOL ret = FALSE;
HANDLE hFind = FindFirstFile(Path, &fd);
if ((hFind != INVALID_HANDLE_VALUE) && (fd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY))
{
//目录存在
ret = TRUE;
}
FindClose(hFind);
return ret;
}
BOOL CPubFunc::CreateDirectory(CString path)
{
SECURITY_ATTRIBUTES attrib;
attrib.bInheritHandle = FALSE;
attrib.lpSecurityDescriptor = NULL;
attrib.nLength = sizeof(SECURITY_ATTRIBUTES);
return ::CreateDirectory( path, &attrib);
}