本文整理汇总了C++中nfind::CFileInfoW::getFileName方法的典型用法代码示例。如果您正苦于以下问题:C++ CFileInfoW::getFileName方法的具体用法?C++ CFileInfoW::getFileName怎么用?C++ CFileInfoW::getFileName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类nfind::CFileInfoW
的用法示例。
在下文中一共展示了CFileInfoW::getFileName方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: AddDirFileInfo
void AddDirFileInfo(
const UString &prefix, // prefix for logical path
const UString &fullPathName, // path on disk: can be relative to some basePrefix
const NFind::CFileInfoW &fileInfo,
CObjectVector<CDirItem> &dirItems)
{
CDirItem item;
item.Attributes = fileInfo.getAttributes();
item.Size = fileInfo.getSize();
item.CreationTime = fileInfo.getCreationTime();
item.LastAccessTime = fileInfo.getLastAccessTime();
item.LastWriteTime = fileInfo.getLastWriteTime();
item.Name = prefix + fileInfo.getFileName();
item.FullPath = fullPathName;
dirItems.Add(item);
}
示例2: EnumerateDirItems
static HRESULT EnumerateDirItems(
const NWildcard::CCensorNode &curNode,
const UString &diskPrefix, // full disk path prefix
const UString &archivePrefix, // prefix from root
const UStringVector &addArchivePrefix, // prefix from curNode
CObjectVector<CDirItem> &dirItems,
bool enterToSubFolders,
IEnumDirItemCallback *callback,
UStringVector &errorPaths,
CRecordVector<DWORD> &errorCodes)
{
if (!enterToSubFolders)
if (curNode.NeedCheckSubDirs())
enterToSubFolders = true;
if (callback)
RINOK(callback->CheckBreak());
// try direct_names case at first
if (addArchivePrefix.IsEmpty() && !enterToSubFolders)
{
// check that all names are direct
int i;
for (i = 0; i < curNode.IncludeItems.Size(); i++)
{
const NWildcard::CItem &item = curNode.IncludeItems[i];
if (item.Recursive || item.PathParts.Size() != 1)
break;
const UString &name = item.PathParts.Front();
if (name.IsEmpty() || DoesNameContainWildCard(name))
break;
}
if (i == curNode.IncludeItems.Size())
{
// all names are direct (no wildcards)
// so we don't need file_system's dir enumerator
CRecordVector<bool> needEnterVector;
for (i = 0; i < curNode.IncludeItems.Size(); i++)
{
const NWildcard::CItem &item = curNode.IncludeItems[i];
const UString &name = item.PathParts.Front();
const UString fullPath = diskPrefix + name;
NFind::CFileInfoW fileInfo;
if (!NFind::FindFile(fullPath, fileInfo))
{
errorCodes.Add(::GetLastError());
errorPaths.Add(fullPath);
continue;
}
bool isDir = fileInfo.IsDirectory();
if (isDir && !item.ForDir || !isDir && !item.ForFile)
{
errorCodes.Add((DWORD)E_FAIL);
errorPaths.Add(fullPath);
continue;
}
const UString realName = fileInfo.getFileName();
const UString realDiskPath = diskPrefix + realName;
{
UStringVector pathParts;
pathParts.Add(fileInfo.getFileName());
if (curNode.CheckPathToRoot(false, pathParts, !isDir))
continue;
}
AddDirFileInfo(archivePrefix, realDiskPath, fileInfo, dirItems);
if (!isDir)
continue;
UStringVector addArchivePrefixNew;
const NWildcard::CCensorNode *nextNode = 0;
int index = curNode.FindSubNode(name);
if (index >= 0)
{
for (int t = needEnterVector.Size(); t <= index; t++)
needEnterVector.Add(true);
needEnterVector[index] = false;
nextNode = &curNode.SubNodes[index];
}
else
{
nextNode = &curNode;
addArchivePrefixNew.Add(name); // don't change it to realName. It's for shortnames support
}
RINOK(EnumerateDirItems(*nextNode,
realDiskPath + wchar_t(kDirDelimiter),
archivePrefix + realName + wchar_t(kDirDelimiter),
addArchivePrefixNew, dirItems, true, callback, errorPaths, errorCodes));
}
for (i = 0; i < curNode.SubNodes.Size(); i++)
{
if (i < needEnterVector.Size())
if (!needEnterVector[i])
continue;
const NWildcard::CCensorNode &nextNode = curNode.SubNodes[i];
const UString fullPath = diskPrefix + nextNode.Name;
NFind::CFileInfoW fileInfo;
if (!NFind::FindFile(fullPath, fileInfo))
{
if (!nextNode.AreThereIncludeItems())
continue;
errorCodes.Add(::GetLastError());
//.........这里部分代码省略.........