当前位置: 首页>>代码示例>>C++>>正文


C++ nfind::CFileInfo类代码示例

本文整理汇总了C++中nfind::CFileInfo的典型用法代码示例。如果您正苦于以下问题:C++ CFileInfo类的具体用法?C++ CFileInfo怎么用?C++ CFileInfo使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了CFileInfo类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: AddPrefix

void CDirItems::EnumerateDirItems2(const FString &phyPrefix, const UString &logPrefix,
    const FStringVector &filePaths, FStringVector &errorPaths, CRecordVector<DWORD> &errorCodes)
{
  int phyParent = phyPrefix.IsEmpty() ? -1 : AddPrefix(-1, -1, fs2us(phyPrefix));
  int logParent = logPrefix.IsEmpty() ? -1 : AddPrefix(-1, -1, logPrefix);

  for (int i = 0; i < filePaths.Size(); i++)
  {
    const FString &filePath = filePaths[i];
    NFind::CFileInfo fi;
    const FString phyPath = phyPrefix + filePath;
    if (!fi.Find(phyPath))
    {
      errorCodes.Add(::GetLastError());
      errorPaths.Add(phyPath);
      continue;
    }
    int delimiter = filePath.ReverseFind(FCHAR_PATH_SEPARATOR);
    FString phyPrefixCur;
    int phyParentCur = phyParent;
    if (delimiter >= 0)
    {
      phyPrefixCur = filePath.Left(delimiter + 1);
      phyParentCur = AddPrefix(phyParent, logParent, fs2us(phyPrefixCur));
    }
    AddDirFileInfo(phyParentCur, logParent, fi, Items);
    if (fi.IsDir())
    {
      const FString name2 = fi.Name + FCHAR_PATH_SEPARATOR;
      int parent = AddPrefix(phyParentCur, logParent, fs2us(name2));
      EnumerateDirectory(parent, parent, phyPrefix + phyPrefixCur + name2, errorPaths, errorCodes);
    }
  }
  ReserveDown();
}
开发者ID:Dabil,项目名称:puNES,代码行数:35,代码来源:EnumDirItems.cpp

示例2: EnumerateDir

void CDirItems::EnumerateDir(int phyParent, int logParent, const FString &phyPrefix)
{
  NFind::CEnumerator enumerator(phyPrefix + FCHAR_ANY_MASK);
  for (;;)
  {
    NFind::CFileInfo fi;
    bool found;
    if (!enumerator.Next(fi, found))
    {
      AddError(phyPrefix);
      return;
    }
    if (!found)
      break;

    int secureIndex = -1;
    #ifdef _USE_SECURITY_CODE
    if (ReadSecure)
      AddSecurityItem(phyPrefix + fi.Name, secureIndex);
    #endif
    
    AddDirFileInfo(phyParent, logParent, secureIndex, fi, Items);
    
    if (fi.IsDir())
    {
      const FString name2 = fi.Name + FCHAR_PATH_SEPARATOR;
      unsigned parent = AddPrefix(phyParent, logParent, fs2us(name2));
      EnumerateDir(parent, parent, phyPrefix + name2);
    }
  }
}
开发者ID:OwenTan,项目名称:AndroidP7zip,代码行数:31,代码来源:EnumDirItems.cpp

示例3: EnumerateDirectory

void CDirItems::EnumerateDirectory(int phyParent, int logParent, const FString &phyPrefix,
    FStringVector &errorPaths, CRecordVector<DWORD> &errorCodes)
{
  NFind::CEnumerator enumerator(phyPrefix + FCHAR_ANY_MASK);
  for (;;)
  {
    NFind::CFileInfo fi;
    bool found;
    if (!enumerator.Next(fi, found))
    {
      errorCodes.Add(::GetLastError());
      errorPaths.Add(phyPrefix);
      return;
    }
    if (!found)
      break;
    AddDirFileInfo(phyParent, logParent, fi, Items);
    if (fi.IsDir())
    {
      const FString name2 = fi.Name + FCHAR_PATH_SEPARATOR;
      int parent = AddPrefix(phyParent, logParent, fs2us(name2));
      EnumerateDirectory(parent, parent, phyPrefix + name2, errorPaths, errorCodes);
    }
  }
}
开发者ID:Dabil,项目名称:puNES,代码行数:25,代码来源:EnumDirItems.cpp

示例4: GetNextFile

HRESULT CDirEnumerator::GetNextFile(NFind::CFileInfo &fileInfo, bool &filled, FString &resPath)
{
  filled = false;
  for (;;)
  {
    if (Enumerators.IsEmpty())
    {
      if (Index >= FileNames.Size())
        return S_OK;
      const FString &path = FileNames[Index];
      int pos = path.ReverseFind(FCHAR_PATH_SEPARATOR);
      resPath.Empty();
      if (pos >= 0)
        resPath = path.Left(pos + 1);

      #ifdef _WIN32
      // it's for "c:" paths/
      if (BasePrefix.IsEmpty() && path.Length() == 2 && path[1] == ':')
      {
        fileInfo.Name = path;
        fileInfo.Attrib = FILE_ATTRIBUTE_DIRECTORY;
        fileInfo.Size = 0;
      }
      else
      #endif
      if (!fileInfo.Find(BasePrefix + path))
      {
        WRes errorCode = GetNormalizedError();
        resPath = path;
        return errorCode;
      }
      Index++;
      break;
    }
    bool found;
    if (!Enumerators.Back().Next(fileInfo, found))
    {
      HRESULT errorCode = GetNormalizedError();
      resPath = Prefixes.Back();
      return errorCode;
    }
    if (found)
    {
      resPath = Prefixes.Back();
      break;
    }
    Enumerators.DeleteBack();
    Prefixes.DeleteBack();
  }
  resPath += fileInfo.Name;
  if (!FlatMode && fileInfo.IsDir())
  {
    FString prefix = resPath + FCHAR_PATH_SEPARATOR;
    Enumerators.Add(NFind::CEnumerator(BasePrefix + prefix + FCHAR_ANY_MASK));
    Prefixes.Add(prefix);
  }
  filled = true;
  return S_OK;
}
开发者ID:walrus8u,项目名称:extract,代码行数:59,代码来源:PanelCrc.cpp

示例5: AddPrefix

HRESULT CDirItems::EnumerateItems2(
    const FString &phyPrefix,
    const UString &logPrefix,
    const FStringVector &filePaths,
    FStringVector *requestedPaths)
{
  int phyParent = phyPrefix.IsEmpty() ? -1 : AddPrefix(-1, -1, fs2us(phyPrefix));
  int logParent = logPrefix.IsEmpty() ? -1 : AddPrefix(-1, -1, logPrefix);

  FOR_VECTOR (i, filePaths)
  {
    const FString &filePath = filePaths[i];
    NFind::CFileInfo fi;
    const FString phyPath = phyPrefix + filePath;
    if (!fi.Find(phyPath))
    {
      RINOK(AddError(phyPath));
      continue;
    }
    if (requestedPaths)
      requestedPaths->Add(phyPath);

    int delimiter = filePath.ReverseFind_PathSepar();
    FString phyPrefixCur;
    int phyParentCur = phyParent;
    if (delimiter >= 0)
    {
      phyPrefixCur.SetFrom(filePath, delimiter + 1);
      phyParentCur = AddPrefix(phyParent, logParent, fs2us(phyPrefixCur));
    }

    int secureIndex = -1;
    #ifdef _USE_SECURITY_CODE
    if (ReadSecure)
    {
      RINOK(AddSecurityItem(phyPath, secureIndex));
    }
    #endif

    AddDirFileInfo(phyParentCur, logParent, secureIndex, fi);
    
    if (fi.IsDir())
    {
      const FString name2 = fi.Name + FCHAR_PATH_SEPARATOR;
      unsigned parent = AddPrefix(phyParentCur, logParent, fs2us(name2));
      RINOK(EnumerateDir(parent, parent, phyPrefix + phyPrefixCur + name2));
    }
  }
  
  ReserveDown();
  return S_OK;
}
开发者ID:jbeich,项目名称:platform_external_lzma,代码行数:52,代码来源:EnumDirItems.cpp

示例6: ConvertToLongName

static void ConvertToLongName(const UString &prefix, UString &name)
{
  if (name.IsEmpty() || DoesNameContainWildcard(name))
    return;
  NFind::CFileInfo fi;
  const FString path = us2fs(prefix + name);
  #ifndef UNDER_CE
  if (NFile::NName::IsDevicePath(path))
    return;
  #endif
  if (fi.Find(path))
    name = fs2us(fi.Name);
}
开发者ID:ming-hai,项目名称:soui,代码行数:13,代码来源:ArchiveCommandLine.cpp

示例7: AddDirFileInfo

void CDirItems::AddDirFileInfo(int phyParent, int logParent, int secureIndex,
    const NFind::CFileInfo &fi)
{
  CDirItem di;
  di.Size = fi.Size;
  di.CTime = fi.CTime;
  di.ATime = fi.ATime;
  di.MTime = fi.MTime;
  di.Attrib = fi.Attrib;
  di.IsAltStream = fi.IsAltStream;
  di.PhyParent = phyParent;
  di.LogParent = logParent;
  di.SecureIndex = secureIndex;
  di.Name = fs2us(fi.Name);
  #if defined(_WIN32) && !defined(UNDER_CE)
  // di.ShortName = fs2us(fi.ShortName);
  #endif
  Items.Add(di);
  
  if (fi.IsDir())
    Stat.NumDirs++;
  else if (fi.IsAltStream)
  {
    Stat.NumAltStreams++;
    Stat.AltStreamsSize += fi.Size;
  }
  else
  {
    Stat.NumFiles++;
    Stat.FilesSize += fi.Size;
  }
}
开发者ID:jbeich,项目名称:platform_external_lzma,代码行数:32,代码来源:EnumDirItems.cpp

示例8: SetLinkInfo

HRESULT CDirItems::SetLinkInfo(CDirItem &dirItem, const NFind::CFileInfo &fi,
    const FString &phyPrefix)
{
  if (!SymLinks || !fi.HasReparsePoint())
    return S_OK;
  const FString path = phyPrefix + fi.Name;
  CByteBuffer &buf = dirItem.ReparseData;
  DWORD res = 0;
  if (NIO::GetReparseData(path, buf))
  {
    CReparseAttr attr;
    if (attr.Parse(buf, buf.Size(), res))
      return S_OK;
    // we ignore unknown reparse points
    if (res != ERROR_INVALID_REPARSE_DATA)
      res = 0;
  }
  else
  {
    res = ::GetLastError();
    if (res == 0)
      res = ERROR_INVALID_FUNCTION;
  }

  buf.Free();
  if (res == 0)
    return S_OK;
  return AddError(path, res);
}
开发者ID:jbeich,项目名称:platform_external_lzma,代码行数:29,代码来源:EnumDirItems.cpp

示例9: MyFormatNew

  void Process2()
  {
    NFind::CFileInfo fi;
    if (!fi.Find(FileName))
    {
      ErrorMessage = kCantFindArchive;
      Result = E_FAIL;
      return;
    }

    CObjectVector<COpenType> incl;
    CIntVector excl;
    COpenOptions options;
    options.codecs = Codecs;
    options.types = &incl;
    options.excludedFormats = &excl;
    options.filePath = fs2us(FileName);
    
    Result = ArchiveLink.Open2(options, ExtractCallbackSpec);
    if (Result != S_OK)
    {
      if (Result != S_OK)
        ErrorMessage = kCantOpenArchive;
      return;
    }

    FString dirPath = DestFolder;
    NName::NormalizeDirPathPrefix(dirPath);
    
    if (!CreateComplexDir(dirPath))
    {
      ErrorMessage = MyFormatNew(IDS_CANNOT_CREATE_FOLDER,
        #ifdef LANG
        0x02000603,
        #endif
        fs2us(dirPath));
      Result = E_FAIL;
      return;
    }

    ExtractCallbackSpec->Init(ArchiveLink.GetArchive(), dirPath, L"Default", fi.MTime, 0);

    Result = ArchiveLink.GetArchive()->Extract(0, (UInt32)(Int32)-1 , BoolToInt(false), ExtractCallback);
  }
开发者ID:DXMonster,项目名称:android_external_lzma,代码行数:44,代码来源:ExtractEngine.cpp

示例10: DeleteEmptyFolderAndEmptySubFolders

static bool DeleteEmptyFolderAndEmptySubFolders(const FString &path)
{
  NFind::CFileInfo fileInfo;
  FString pathPrefix = path + FCHAR_PATH_SEPARATOR;
  {
    NFind::CEnumerator enumerator(pathPrefix + FCHAR_ANY_MASK);
    while (enumerator.Next(fileInfo))
    {
      if (fileInfo.IsDir())
        if (!DeleteEmptyFolderAndEmptySubFolders(pathPrefix + fileInfo.Name))
          return false;
    }
  }
  /*
  // we don't need clear read-only for folders
  if (!MySetFileAttributes(path, 0))
    return false;
  */
  return RemoveDir(path);
}
开发者ID:djdron,项目名称:zxtune,代码行数:20,代码来源:Update.cpp

示例11: EnumerateDir

HRESULT CDirItems::EnumerateDir(int phyParent, int logParent, const FString &phyPrefix)
{
  RINOK(ScanProgress(phyPrefix));

  NFind::CEnumerator enumerator;
  enumerator.SetDirPrefix(phyPrefix);
  for (unsigned ttt = 0; ; ttt++)
  {
    NFind::CFileInfo fi;
    bool found;
    if (!enumerator.Next(fi, found))
    {
      return AddError(phyPrefix);
    }
    if (!found)
      return S_OK;

    int secureIndex = -1;
    #ifdef _USE_SECURITY_CODE
    if (ReadSecure)
    {
      RINOK(AddSecurityItem(phyPrefix + fi.Name, secureIndex));
    }
    #endif
    
    AddDirFileInfo(phyParent, logParent, secureIndex, fi);
    
    if (Callback && (ttt & kScanProgressStepMask) == kScanProgressStepMask)
    {
      RINOK(ScanProgress(phyPrefix));
    }

    if (fi.IsDir())
    {
      const FString name2 = fi.Name + FCHAR_PATH_SEPARATOR;
      unsigned parent = AddPrefix(phyParent, logParent, fs2us(name2));
      RINOK(EnumerateDir(parent, parent, phyPrefix + name2));
    }
  }
}
开发者ID:jbeich,项目名称:platform_external_lzma,代码行数:40,代码来源:EnumDirItems.cpp

示例12: GetBaseFolderPrefixFromRegistry

CSysString GetBaseFolderPrefixFromRegistry()
{
  CSysString moduleFolderPrefix = GetLibraryFolderPrefix();
  NFind::CFileInfo fileInfo;
  if (NFind::FindFile(moduleFolderPrefix + kMainDll, fileInfo))
	if (!fileInfo.IsDirectory())
	  return moduleFolderPrefix;
  if (NFind::FindFile(moduleFolderPrefix + kCodecsFolderName, fileInfo))
	if (fileInfo.IsDirectory())
	  return moduleFolderPrefix;
  if (NFind::FindFile(moduleFolderPrefix + kFormatsFolderName, fileInfo))
	if (fileInfo.IsDirectory())
	  return moduleFolderPrefix;
  #ifdef _WIN32
  CSysString path;
  if (ReadPathFromRegistry(HKEY_CURRENT_USER, path))
	return path;
  if (ReadPathFromRegistry(HKEY_LOCAL_MACHINE, path))
	return path;
  #endif
  return moduleFolderPrefix;
}
开发者ID:AMDmi3,项目名称:symwars3,代码行数:22,代码来源:LoadCodecs.cpp

示例13: DeleteEmptyFolderAndEmptySubFolders

static bool DeleteEmptyFolderAndEmptySubFolders(const FString &path)
{
  NFind::CFileInfo fileInfo;
  FString pathPrefix = path;
  pathPrefix.Add_PathSepar();
  {
    NFind::CEnumerator enumerator;
    enumerator.SetDirPrefix(pathPrefix);
    while (enumerator.Next(fileInfo))
    {
      if (fileInfo.IsDir())
        if (!DeleteEmptyFolderAndEmptySubFolders(pathPrefix + fileInfo.Name))
          return false;
    }
  }
  /*
  // we don't need clear readonly for folders
  if (!SetFileAttrib(path, 0))
    return false;
  */
  return RemoveDir(path);
}
开发者ID:mcmilk,项目名称:7-Zip-zstd,代码行数:22,代码来源:ArchiveFolderOut.cpp

示例14: ReadPluginInfoList

void ReadPluginInfoList(CObjectVector<CPluginInfo> &plugins)
{
  plugins.Clear();

  FString baseFolderPrefix = NDLL::GetModuleDirPrefix();
  {
    CPluginInfo pluginInfo;
    pluginInfo.FilePath = baseFolderPrefix + FTEXT("7-zip.dll");
    if (::ReadPluginInfo(pluginInfo, false))
      plugins.Add(pluginInfo);
  }
  FString folderPath = baseFolderPrefix + FTEXT("Plugins") FSTRING_PATH_SEPARATOR;
  NFind::CEnumerator enumerator(folderPath + FCHAR_ANY_MASK);
  NFind::CFileInfo fileInfo;
  while (enumerator.Next(fileInfo))
  {
    if (fileInfo.IsDir())
      continue;
    CPluginInfo pluginInfo;
    pluginInfo.FilePath = folderPath + fileInfo.Name;
    if (::ReadPluginInfo(pluginInfo, true))
      plugins.Add(pluginInfo);
  }
}
开发者ID:walrus8u,项目名称:extract,代码行数:24,代码来源:RegistryPlugins.cpp

示例15: SetLinkInfo

void CDirItems::SetLinkInfo(CDirItem &dirItem, const NFind::CFileInfo &fi,
    const FString &phyPrefix)
{
  if (!SymLinks || !fi.HasReparsePoint())
    return;
  const FString path = phyPrefix + fi.Name;
  CByteBuffer &buf = dirItem.ReparseData;
  if (NIO::GetReparseData(path, buf))
  {
    CReparseAttr attr;
    if (attr.Parse(buf, buf.Size()))
      return;
  }
  AddError(path);
  buf.Free();
}
开发者ID:OwenTan,项目名称:AndroidP7zip,代码行数:16,代码来源:EnumDirItems.cpp


注:本文中的nfind::CFileInfo类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。