本文整理汇总了C++中CFileInfo::IsDir方法的典型用法代码示例。如果您正苦于以下问题:C++ CFileInfo::IsDir方法的具体用法?C++ CFileInfo::IsDir怎么用?C++ CFileInfo::IsDir使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CFileInfo
的用法示例。
在下文中一共展示了CFileInfo::IsDir方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Enumerate
HRESULT CFsFolderStat::Enumerate()
{
if (Progress)
{
RINOK(Progress->SetCompleted(NULL));
}
Path.Add_PathSepar();
const unsigned len = Path.Len();
CEnumerator enumerator;
enumerator.SetDirPrefix(Path);
CFileInfo fi;
while (enumerator.Next(fi))
{
if (fi.IsDir())
{
Path.DeleteFrom(len);
Path += fi.Name;
RINOK(Enumerate());
NumFolders++;
}
else
{
NumFiles++;
Size += fi.Size;
}
}
return S_OK;
}
示例2: BindToPath
//.........这里部分代码省略.........
CFileInfo fileInfo;
while (!sysPath.IsEmpty())
{
if (fileInfo.Find(us2fs(sysPath)))
break;
int pos = sysPath.ReverseFind_PathSepar();
if (pos < 0)
sysPath.Empty();
else
{
/*
if (reducedParts.Size() > 0 || pos < (int)sysPath.Len() - 1)
reducedParts.Add(sysPath.Ptr(pos + 1));
*/
#if defined(_WIN32) && !defined(UNDER_CE)
if (pos == 2 && NName::IsDrivePath2(sysPath) && sysPath.Len() > 3)
pos++;
#endif
sysPath.DeleteFrom(pos);
}
}
SetToRootFolder();
CMyComPtr<IFolderFolder> newFolder;
if (sysPath.IsEmpty())
{
_folder->BindToFolder(path, &newFolder);
}
else if (fileInfo.IsDir())
{
NName::NormalizeDirPathPrefix(sysPath);
_folder->BindToFolder(sysPath, &newFolder);
}
else
{
FString dirPrefix, fileName;
NDir::GetFullPathAndSplit(us2fs(sysPath), dirPrefix, fileName);
HRESULT res;
// = OpenAsArc(fs2us(fileName), arcFormat, encrypted);
{
CTempFileInfo tfi;
tfi.RelPath = fs2us(fileName);
tfi.FolderPath = dirPrefix;
tfi.FilePath = us2fs(sysPath);
res = OpenAsArc(NULL, tfi, sysPath, arcFormat, encrypted);
}
if (res == S_FALSE)
_folder->BindToFolder(fs2us(dirPrefix), &newFolder);
else
{
RINOK(res);
archiveIsOpened = true;
_parentFolders.Back().ParentFolderPath = fs2us(dirPrefix);
path.DeleteFrontal(sysPath.Len());
if (!path.IsEmpty() && IS_PATH_SEPAR(path[0]))
path.Delete(0);
}
}
if (newFolder)
示例3: BindToPath
HRESULT CPanel::BindToPath(const UString &fullPath, const UString &arcFormat, bool &archiveIsOpened, bool &encrypted)
{
archiveIsOpened = false;
encrypted = false;
CDisableTimerProcessing disableTimerProcessing(*this);
CDisableNotify disableNotify(*this);
if (_parentFolders.Size() > 0)
{
const UString &virtPath = _parentFolders.Back().VirtualPath;
if (fullPath.IsPrefixedBy(virtPath))
{
for (;;)
{
CMyComPtr<IFolderFolder> newFolder;
HRESULT res = _folder->BindToParentFolder(&newFolder);
if (!newFolder || res != S_OK)
break;
SetNewFolder(newFolder);
}
UStringVector parts;
SplitPathToParts(fullPath.Ptr(virtPath.Len()), parts);
FOR_VECTOR (i, parts)
{
const UString &s = parts[i];
if ((i == 0 || i == parts.Size() - 1) && s.IsEmpty())
continue;
CMyComPtr<IFolderFolder> newFolder;
HRESULT res = _folder->BindToFolder(s, &newFolder);
if (!newFolder || res != S_OK)
break;
SetNewFolder(newFolder);
}
return S_OK;
}
}
CloseOpenFolders();
UString sysPath = fullPath;
CFileInfo fileInfo;
UStringVector reducedParts;
while (!sysPath.IsEmpty())
{
if (fileInfo.Find(us2fs(sysPath)))
break;
int pos = sysPath.ReverseFind(WCHAR_PATH_SEPARATOR);
if (pos < 0)
sysPath.Empty();
else
{
if (reducedParts.Size() > 0 || pos < (int)sysPath.Len() - 1)
reducedParts.Add(sysPath.Ptr(pos + 1));
sysPath.DeleteFrom(pos);
}
}
SetToRootFolder();
CMyComPtr<IFolderFolder> newFolder;
if (sysPath.IsEmpty())
{
if (_folder->BindToFolder(fullPath, &newFolder) == S_OK)
SetNewFolder(newFolder);
}
else if (fileInfo.IsDir())
{
NName::NormalizeDirPathPrefix(sysPath);
if (_folder->BindToFolder(sysPath, &newFolder) == S_OK)
SetNewFolder(newFolder);
}
else
{
FString dirPrefix, fileName;
NDir::GetFullPathAndSplit(us2fs(sysPath), dirPrefix, fileName);
if (_folder->BindToFolder(fs2us(dirPrefix), &newFolder) == S_OK)
{
SetNewFolder(newFolder);
LoadFullPath();
{
HRESULT res = OpenItemAsArchive(fs2us(fileName), arcFormat, encrypted);
if (res != S_FALSE)
{
RINOK(res);
}
/*
if (res == E_ABORT)
return res;
*/
if (res == S_OK)
{
archiveIsOpened = true;
for (int i = reducedParts.Size() - 1; i >= 0; i--)
{
CMyComPtr<IFolderFolder> newFolder;
_folder->BindToFolder(reducedParts[i], &newFolder);
if (!newFolder)
break;
SetNewFolder(newFolder);
}
}
}
}
//.........这里部分代码省略.........
示例4: DoesDirExist
bool DoesDirExist(CFSTR name)
{
CFileInfo fi;
return fi.Find(name) && fi.IsDir();
}
示例5: DoesFileExist
bool DoesFileExist(LPCTSTR name)
{
CFileInfo fi;
return fi.Find(name) && !fi.IsDir();
}