本文整理汇总了C++中nfind::CFileInfoW::IsDirectory方法的典型用法代码示例。如果您正苦于以下问题:C++ CFileInfoW::IsDirectory方法的具体用法?C++ CFileInfoW::IsDirectory怎么用?C++ CFileInfoW::IsDirectory使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类nfind::CFileInfoW
的用法示例。
在下文中一共展示了CFileInfoW::IsDirectory方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: EnumerateDirItems
void EnumerateDirItems(
const UString &baseFolderPrefix, // base (disk) prefix for scanning
const UStringVector &fileNames, // names relative to baseFolderPrefix
const UString &archiveNamePrefix,
CObjectVector<CDirItem> &dirItems,
UStringVector &errorPaths,
CRecordVector<DWORD> &errorCodes)
{
for(int i = 0; i < fileNames.Size(); i++)
{
const UString &fileName = fileNames[i];
NFind::CFileInfoW fileInfo;
if (!NFind::FindFile(baseFolderPrefix + fileName, fileInfo))
{
errorCodes.Add(::GetLastError());
errorPaths.Add(baseFolderPrefix + fileName);
continue;
}
AddDirFileInfo(archiveNamePrefix, fileName, fileInfo, dirItems);
if (fileInfo.IsDirectory())
{
EnumerateDirectory(baseFolderPrefix, fileName + wchar_t(kDirDelimiter),
archiveNamePrefix + fileInfo.Name + wchar_t(kDirDelimiter),
dirItems, errorPaths, errorCodes);
}
}
}
示例2: EnumerateDirectory
static void EnumerateDirectory(
const UString &baseFolderPrefix, // base (disk) prefix for scanning
const UString &directory, // additional disk prefix starting from baseFolderPrefix
const UString &prefix, // logical prefix
CObjectVector<CDirItem> &dirItems,
UStringVector &errorPaths,
CRecordVector<DWORD> &errorCodes)
{
NFind::CEnumeratorW enumerator(baseFolderPrefix + directory + wchar_t(kAnyStringWildcard));
for (;;)
{
NFind::CFileInfoW fileInfo;
bool found;
if (!enumerator.Next(fileInfo, found))
{
errorCodes.Add(::GetLastError());
errorPaths.Add(baseFolderPrefix + directory);
return;
}
if (!found)
break;
AddDirFileInfo(prefix, directory + fileInfo.Name, fileInfo, dirItems);
if (fileInfo.IsDirectory())
{
EnumerateDirectory(baseFolderPrefix, directory + fileInfo.Name + wchar_t(kDirDelimiter),
prefix + fileInfo.Name + wchar_t(kDirDelimiter), dirItems, errorPaths, errorCodes);
}
}
}
示例3: GetNextFile
bool CDirEnumerator::GetNextFile(NFind::CFileInfoW &fileInfo, bool &filled, UString &resPath, DWORD &errorCode)
{
filled = false;
for (;;)
{
if (Enumerators.IsEmpty())
{
if (Index >= FileNames.Size())
return true;
const UString &path = FileNames[Index];
int pos = path.ReverseFind('\\');
resPath.Empty();
if (pos >= 0)
resPath = path.Left(pos + 1);
if (!NFind::FindFile(BasePrefix + path, fileInfo))
{
errorCode = ::GetLastError();
resPath = path;
return false;
}
Index++;
break;
}
bool found;
if (!Enumerators.Back().Next(fileInfo, found))
{
errorCode = ::GetLastError();
resPath = Prefixes.Back();
return false;
}
if (found)
{
resPath = Prefixes.Back();
break;
}
Enumerators.DeleteBack();
Prefixes.DeleteBack();
}
resPath += fileInfo.Name;
if (!FlatMode && fileInfo.IsDirectory())
{
UString prefix = resPath + (UString)(wchar_t)kDirDelimiter;
Enumerators.Add(NFind::CEnumeratorW(BasePrefix + prefix + (UString)(wchar_t)kAnyStringWildcard));
Prefixes.Add(prefix);
}
filled = true;
return true;
}
示例4: GetBaseFolderPrefixFromRegistry
static UString GetBaseFolderPrefixFromRegistry()
{
UString moduleFolderPrefix = GetModuleFolderPrefix();
NFind::CFileInfoW fileInfo;
if (NFind::FindFile(moduleFolderPrefix + kFormatFolderName, fileInfo))
if (fileInfo.IsDirectory())
return moduleFolderPrefix;
UString path;
#ifdef _WIN32
if(ReadPathFromRegistry(HKEY_CURRENT_USER, path))
return path;
if(ReadPathFromRegistry(HKEY_LOCAL_MACHINE, path))
return path;
#endif
return moduleFolderPrefix;
}
示例5: ReadArchiverInfoList
//.........这里部分代码省略.........
{
CArchiverInfo item;
item.Name = L"Arj";
item.Extensions.Add(CArchiverExtInfo(L"arj"));
#ifndef _SFX
const unsigned char sig[] = { 0x60, 0xEA };
SetBuffer(item.StartSignature, sig, 2);
#endif
archivers.Add(item);
}
#endif
#ifdef FORMAT_Z
{
CArchiverInfo item;
item.Name = L"Z";
item.Extensions.Add(CArchiverExtInfo(L"Z"));
#ifndef _SFX
const unsigned char sig[] = { 0x1F, 0x9D };
SetBuffer(item.StartSignature, sig, 2);
#endif
archivers.Add(item);
}
#endif
#else
UString folderPath = GetBaseFolderPrefixFromRegistry() +
(UString)kFormatFolderName + (UString)WSTRING_PATH_SEPARATOR;
NFind::CEnumeratorW enumerator(folderPath + L"*");
NFind::CFileInfoW fileInfo;
while (enumerator.Next(fileInfo))
{
if (fileInfo.IsDirectory())
continue;
UString filePath = folderPath + fileInfo.Name;
{
NDLL::CLibrary library;
if (!library.LoadEx(filePath, LOAD_LIBRARY_AS_DATAFILE))
continue;
}
NDLL::CLibrary library;
if (!library.Load(filePath))
continue;
GetHandlerPropertyFunc getHandlerProperty = (GetHandlerPropertyFunc)
library.GetProcAddress("GetHandlerProperty");
if (getHandlerProperty == NULL)
continue;
CArchiverInfo item;
item.FilePath = filePath;
NWindows::NCOM::CPropVariant prop;
if (getHandlerProperty(NArchive::kName, &prop) != S_OK)
continue;
if (prop.vt != VT_BSTR)
continue;
item.Name = prop.bstrVal;
prop.Clear();
if (getHandlerProperty(NArchive::kClassID, &prop) != S_OK)
continue;
if (prop.vt != VT_BSTR)
continue;
item.ClassID = *(const GUID *)prop.bstrVal;
示例6: ShowDialog
static HRESULT ShowDialog(
CCodecs *codecs,
const NWildcard::CCensor &censor,
CUpdateOptions &options, CUpdateCallbackGUI *callback)
{
if (options.Commands.Size() != 1)
throw "It must be one command";
UString currentDirPrefix;
{
if (!NDirectory::MyGetCurrentDirectory(currentDirPrefix))
return E_FAIL;
NName::NormalizeDirPathPrefix(currentDirPrefix);
}
bool oneFile = false;
NFind::CFileInfoW fileInfo;
if (censor.Pairs.Size() > 0)
{
const NWildcard::CPair &pair = censor.Pairs[0];
if (pair.Head.IncludeItems.Size() > 0)
{
const NWildcard::CItem &item = pair.Head.IncludeItems[0];
if (item.ForFile)
{
UString name = pair.Prefix;
for (int i = 0; i < item.PathParts.Size(); i++)
{
if (i > 0)
name += L'\\';
name += item.PathParts[i];
}
if (NFind::FindFile(name, fileInfo))
{
if (censor.Pairs.Size() == 1 && pair.Head.IncludeItems.Size() == 1)
oneFile = !fileInfo.IsDirectory();
}
}
}
}
CCompressDialog dialog;
NCompressDialog::CInfo &di = dialog.Info;
for(int i = 0; i < codecs->Formats.Size(); i++)
{
const CArcInfoEx &ai = codecs->Formats[i];
if (ai.UpdateEnabled && (oneFile || !ai.KeepName))
dialog.m_ArchiverInfoList.Add(ai);
}
if(dialog.m_ArchiverInfoList.Size() == 0)
{
MyMessageBox(L"No Update Engines");
return E_FAIL;
}
// di.ArchiveName = options.ArchivePath.GetFinalPath();
di.ArchiveName = options.ArchivePath.GetPathWithoutExt();
dialog.OriginalFileName = fileInfo.Name;
di.CurrentDirPrefix = currentDirPrefix;
di.SFXMode = options.SfxMode;
di.OpenShareForWrite = options.OpenShareForWrite;
if (callback->PasswordIsDefined)
di.Password = callback->Password;
di.KeepName = !oneFile;
if(dialog.Create(0) != IDOK)
return E_ABORT;
options.VolumesSizes = di.VolumeSizes;
/*
if (di.VolumeSizeIsDefined)
{
MyMessageBox(L"Splitting to volumes is not supported");
return E_FAIL;
}
*/
NUpdateArchive::CActionSet &actionSet = options.Commands.Front().ActionSet;
switch(di.UpdateMode)
{
case NCompressDialog::NUpdateMode::kAdd:
actionSet = NUpdateArchive::kAddActionSet;
break;
case NCompressDialog::NUpdateMode::kUpdate:
actionSet = NUpdateArchive::kUpdateActionSet;
break;
case NCompressDialog::NUpdateMode::kFresh:
actionSet = NUpdateArchive::kFreshActionSet;
break;
case NCompressDialog::NUpdateMode::kSynchronize:
actionSet = NUpdateArchive::kSynchronizeActionSet;
break;
default:
throw 1091756;
}
const CArcInfoEx &archiverInfo = dialog.m_ArchiverInfoList[di.ArchiverInfoIndex];
callback->PasswordIsDefined = (!di.Password.IsEmpty());
//.........这里部分代码省略.........