Exemplo n.º 1
0
bool CFSFolder::SaveComments()
{
  AString utf;
  {
    UString unicode;
    _comments.SaveToString(unicode);
    ConvertUnicodeToUTF8(unicode, utf);
  }
  if (!utf.IsAscii())
    utf.Insert(0, "\xEF\xBB\xBF" "\r\n");

  FString path = _path + kDescriptionFileName;
  // We must set same attrib. COutFile::CreateAlways can fail, if file has another attrib.
  DWORD attrib = FILE_ATTRIBUTE_NORMAL;
  {
    CFileInfo fi;
    if (fi.Find(path))
      attrib = fi.Attrib;
  }
  NIO::COutFile file;
  if (!file.CreateAlways(path, attrib))
    return false;
  UInt32 processed;
  file.Write(utf, utf.Len(), processed);
  _commentsAreLoaded = false;
  return true;
}
Exemplo n.º 2
0
void CFileEvent::RemoveFile (LPCTSTR pszPathName)
  {
    CFileInfo *pFileInfo;
    if (!m_mapFileInfo.Lookup (pszPathName, pFileInfo))
      return;
    ASSERT (pFileInfo);
    POSITION pos = m_lstFilePath.GetHeadPosition (), posOld;
    CFilePath *pFilePath;
    while (pos)
      {
        posOld = pos;
        pFilePath = m_lstFilePath.GetNext (pos);
        ASSERT (pFilePath);
        if (!_tcscmp (pFilePath->GetPath (), pFileInfo->GetPath ()))
          {
            if (pFilePath->GetCount () == 1)
              {
                delete pFilePath;
                delete pFileInfo;
                m_lstFilePath.RemoveAt (posOld);
                m_mapFileInfo.RemoveKey (pszPathName);
              }
            else
              pFilePath->Dec ();
            return;
          }
      }
  }
Exemplo n.º 3
0
void CFileEvent::AddFile (LPCTSTR pszPathName)
  {
    CFileInfo *pFileInfo;
    if (m_mapFileInfo.Lookup (pszPathName, pFileInfo))
      return;
    pFileInfo = new CFileInfo (pszPathName);
    m_mapFileInfo.SetAt (pszPathName, pFileInfo);
    POSITION pos = m_lstFilePath.GetHeadPosition ();
    CFilePath *pFilePath;
    while (pos)
      {
        pFilePath = m_lstFilePath.GetNext (pos);
        ASSERT (pFilePath);
        if (!_tcscmp (pFilePath->GetPath (), pFileInfo->GetPath ()))
          {
            pFilePath->Inc ();
            return;
          }
      }
    m_lstFilePath.AddTail (new CFilePath (pFileInfo->GetPath ()));
    if (m_bEvent)
      {
        StopWatching ();
        StartWatching ();
      }
  }
Exemplo n.º 4
0
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;
}
Exemplo n.º 5
0
// Return current size of file.
//
// size = getFileSize(filename);
//   filename: VFS filename (may include path)
unsigned int JSI_VFS::GetFileSize(ScriptInterface::CxPrivate* UNUSED(pCxPrivate), std::wstring filename)
{
	CFileInfo fileInfo;
	Status err = g_VFS->GetFileInfo(filename, &fileInfo);
	JS_CHECK_FILE_ERR(err);

	return (unsigned int)fileInfo.Size();
}
Exemplo n.º 6
0
// Return time [seconds since 1970] of the last modification to the specified file.
//
// mtime = getFileMTime(filename);
//   filename: VFS filename (may include path)
double JSI_VFS::GetFileMTime(ScriptInterface::CxPrivate* UNUSED(pCxPrivate), std::wstring filename)
{
	CFileInfo fileInfo;
	Status err = g_VFS->GetFileInfo(filename, &fileInfo);
	JS_CHECK_FILE_ERR(err);

	return (double)fileInfo.MTime();
}
int CFileBrowserListCtrl::CalcMinColumnWidth(int Col)
{
	enum {
		BORDER = 6,	// minimal spacing; less causes abbreviated text
		SLACK = 3	// prevents widest item from touching right edge
	};
	CWaitCursor	wc;	// iterating all items can be slow, especially for file type
	CClientDC	dc(this);
	HGDIOBJ	PrevFont = dc.SelectObject(GetFont());	// must use list control's font
	int	width = 0;
	CSize	sz;
	CFileInfo	FileInfo;
	CString	str;
	int	items = m_DirList.GetCount();
	for (int i = 0; i < items; i++) {
		const CDirItem&	item = m_DirList.GetItem(i);
		switch (Col) {
		case COL_NAME:
			str = item.GetName();
			break;
		case COL_SIZE:
			if (item.IsDir())
				continue;
			FormatSize(item.GetLength(), str);
			break;
		case COL_TYPE:	// slow if we have many unique file types that aren't cached
			m_FileInfoCache.GetFileInfo(GetFolder(), item, FileInfo);
			str = FileInfo.GetTypeName();
			break;
		case COL_MODIFIED:
			if (item.GetLastWrite() == 0)
				continue;
			FormatTime(item.GetLastWrite(), str);
			break;
		default:
			ASSERT(0);
		}
		GetTextExtentPoint32(dc.m_hDC, str, str.GetLength(), &sz);
		if (sz.cx > width)
			width = sz.cx;
	}
	dc.SelectObject(PrevFont);	// restore DC's previous font
	// 25feb09: GetItemRect can fail e.g. if list is empty, in which case we
	// must avoid adding garbage to column width
	CRect	IconRect;
	if (GetItemRect(0, IconRect, LVIR_ICON))
		width += IconRect.Width();
	else	// can't get item rect, fall back to system metrics
		width += GetSystemMetrics(m_ViewType == VTP_ICON ? SM_CXICON : SM_CXSMICON);
	width += BORDER + SLACK;
	return(width);
}
Exemplo n.º 8
0
	/**
	 * Creates MD5 hash key from skeletons.xml info and COLLADA converter version,
	 * used to invalidate cached .pmd/psas
	 *
	 * @param[out] hash resulting MD5 hash
	 * @param[out] version version passed to CCacheLoader, used if code change should force
	 *		  cache invalidation
	 */
	void PrepareCacheKey(MD5& hash, u32& version)
	{
		// Add converter version to the hash
		version = COLLADA_CONVERTER_VERSION;

		// Cache the skeleton files hash data
		if (m_skeletonHashInvalidated)
		{
			VfsPaths paths;
			if (vfs::GetPathnames(m_VFS, L"art/skeletons/", L"*.xml", paths) != INFO::OK)
			{
				LOGWARNING("Failed to load skeleton definitions");
				return;
			}

			// Sort the paths to not invalidate the cache if mods are mounted in different order
			// (No need to stable_sort as the VFS gurantees that we have no duplicates)
			std::sort(paths.begin(), paths.end());

			// We need two u64s per file
			m_skeletonHashes.clear();
			m_skeletonHashes.reserve(paths.size()*2);

			CFileInfo fileInfo;
			for (const VfsPath& path : paths)
			{
				// This will cause an assertion failure if *it doesn't exist,
				//	because fileinfo is not a NULL pointer, which is annoying but that
				//	should never happen, unless there really is a problem
				if (m_VFS->GetFileInfo(path, &fileInfo) != INFO::OK)
				{
					LOGERROR("Failed to stat '%s' for DAE caching", path.string8());
				}
				else
				{
					m_skeletonHashes.push_back((u64)fileInfo.MTime() & ~1); //skip lowest bit, since zip and FAT don't preserve it
					m_skeletonHashes.push_back((u64)fileInfo.Size());
				}
			}

			// Check if we were able to load any skeleton files
			if (m_skeletonHashes.empty())
				LOGERROR("Failed to stat any skeleton definitions for DAE caching");
				// We can continue, something else will break if we try loading a skeletal model

			m_skeletonHashInvalidated = false;
		}

		for (const u64& h : m_skeletonHashes)
			hash.Update((const u8*)&h, sizeof(h));
	}
Exemplo n.º 9
0
void CFileManager::FindAllFile(const wstring& strPath,  vector<CFileInfo>& vecFiles)  
{   
    if(strPath.length() < 1)
        return;

	CString cstrFind = strPath.c_str();
		cstrFind +=  _T("\\*.*");

	WIN32_FIND_DATA wfd;  
	HANDLE hFind = ::FindFirstFile(cstrFind, &wfd);  
	if(hFind==INVALID_HANDLE_VALUE)  
		return ;

	string str;
	TCHAR tcharFile[MAX_PATH]; 
	CFileInfo entry;
	bool ifok = false;	
	const wstring wstrRoot = CConfig::GetInstance().GetRootPath();
    
	do  
	{  
        if(m_fHasNewSearch)
            goto End;
		//如果你所在的不是根目录,你将会看到“.”与“..”这两个目录——这是在资源管理器中看不到的。  
		//dos下一个点代表的是当前目录,两个点代表的是上一级目录。若查找的到的是当前文件夹和上一级文件夹,则忽略。  
		if(wfd.cFileName[0]=='.')  
			continue;  
		if(wfd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)  
		{  
			//dir  
			wsprintf(tcharFile,_T("%s\\%s"), strPath.c_str(), wfd.cFileName);  
			FindAllFile(tcharFile, vecFiles);   //recursive call
		}  
		else   
		{  
			//file 
			wsprintf(tcharFile,_T("%s\\%s"), strPath.c_str() , wfd.cFileName); 
			
			entry.Clear();
			entry.m_strFullPathName = tcharFile;
			ifok = entry.ReadAllInfo(wstrRoot);

			vecFiles.push_back(entry);
			//m_vecFileData.push_back("");
             
		}  
	}while(::FindNextFile(hFind,&wfd));  

End:
	::FindClose(hFind);  
}  
Exemplo n.º 10
0
void CPanel::LoadFullPathAndShow()
{
  LoadFullPath();
  _appState->FolderHistory.AddString(_currentFolderPrefix);

  _headerComboBox.SetText(_currentFolderPrefix);

  #ifndef UNDER_CE

  COMBOBOXEXITEM item;
  item.mask = 0;

  UString path = _currentFolderPrefix;
  if (path.Len() >
      #ifdef _WIN32
      3
      #else
      1
      #endif
      && path.Back() == WCHAR_PATH_SEPARATOR)
    path.DeleteBack();

  DWORD attrib = FILE_ATTRIBUTE_DIRECTORY;

  // GetRealIconIndex is slow for direct DVD/UDF path. So we use dummy path
  if (path.IsPrefixedBy(L"\\\\.\\"))
    path = L"_TestFolder_";
  else
  {
    CFileInfo fi;
    if (fi.Find(us2fs(path)))
      attrib = fi.Attrib;
  }
  item.iImage = GetRealIconIndex(us2fs(path), attrib);

  if (item.iImage >= 0)
  {
    item.iSelectedImage = item.iImage;
    item.mask |= (CBEIF_IMAGE | CBEIF_SELECTEDIMAGE);
  }
  item.iItem = -1;
  _headerComboBox.SetItem(&item);
  
  #endif

  RefreshTitle();
}
Exemplo n.º 11
0
bool CEnumerator::Next(CFileInfo &fi)
{
  for (;;)
  {
    if (!NextAny(fi))
      return false;
    if (!fi.IsDots())
      return true;
  }
}
Exemplo n.º 12
0
			bool CEnumerator::Next(CFileInfo &fileInfo)
			{
				while(true)
				{
					if(!NextAny(fileInfo))
      return false;
					if(!fileInfo.IsDots())
      return true;
				}
			}
Exemplo n.º 13
0
int CDirectoryInfo::_SortAllFileInPathByTime(LstFileSystemItemsInPathT& lstFileSystemItemsInPath, MapTimeFileSystemItemT& mapTimeFileSystemItem)
{
	BOOST_LOG_FUNCTION();
	int nFunRes = 0;
	LstFileSystemItemsInPathIterT   iterLst;
	CFileInfo* pFileSystemItem = NULL;
	time_t nFileNameTImeValue = 0;

	iterLst = lstFileSystemItemsInPath.begin();
	while (iterLst != lstFileSystemItemsInPath.end())
	{
		pFileSystemItem = (*iterLst);
		nFileNameTImeValue = pFileSystemItem->getFileNameTime();

		mapTimeFileSystemItem.insert(MapTimeFileSystemItemValueTypeT(nFileNameTImeValue, pFileSystemItem));//auto sort

		iterLst++;
	}//while
	lstFileSystemItemsInPath.clear();

	return nFunRes;
}
Exemplo n.º 14
0
VfsPath CCacheLoader::LooseCachePath(const VfsPath& sourcePath, const MD5& initialHash, u32 version)
{
	CFileInfo fileInfo;
	if (m_VFS->GetFileInfo(sourcePath, &fileInfo) < 0)
	{
		debug_warn(L"source file disappeared"); // this should never happen
		return VfsPath();
	}

	u64 mtime = (u64)fileInfo.MTime() & ~1; // skip lowest bit, since zip and FAT don't preserve it
	u64 size = (u64)fileInfo.Size();

	// Construct a hash of the file data and settings.

	MD5 hash = initialHash;
	hash.Update((const u8*)&mtime, sizeof(mtime));
	hash.Update((const u8*)&size, sizeof(size));
	hash.Update((const u8*)&version, sizeof(version));
	// these are local cached files, so we don't care about endianness etc

	// Use a short prefix of the full hash (we don't need high collision-resistance),
	// converted to hex
	u8 digest[MD5::DIGESTSIZE];
	hash.Final(digest);
	std::wstringstream digestPrefix;
	digestPrefix << std::hex;
	for (size_t i = 0; i < 8; ++i)
		digestPrefix << std::setfill(L'0') << std::setw(2) << (int)digest[i];

	// Get the mod path
	OsPath path;
	m_VFS->GetRealPath(sourcePath, path);

	// Construct the final path
	return VfsPath("cache") / path_name_only(path.BeforeCommon(sourcePath).Parent().string().c_str()) / sourcePath.ChangeExtension(sourcePath.Extension().string() + L"." + digestPrefix.str() + m_FileExtension);
}
static HRESULT UpdateFile(NFsFolder::CCopyStateIO &state, CFSTR inPath, CFSTR outPath, IFolderArchiveUpdateCallback *callback)
{
  if (NFind::DoesFileOrDirExist(outPath))
  {
    RINOK(SendMessageError(callback, NError::MyFormatMessage(ERROR_ALREADY_EXISTS), outPath));
    CFileInfo fi;
    if (fi.Find(inPath))
    {
      if (state.TotalSize >= fi.Size)
        state.TotalSize -= fi.Size;
    }
    return S_OK;
  }

  {
    if (callback)
      RINOK(callback->CompressOperation(fs2us(inPath)));
    RINOK(state.MyCopyFile(inPath, outPath));
    if (state.ErrorFileIndex >= 0)
    {
      if (state.ErrorMessage.IsEmpty())
        state.ErrorMessage = GetLastErrorMessage();
      FString errorName;
      if (state.ErrorFileIndex == 0)
        errorName = inPath;
      else
        errorName = outPath;
      if (callback)
        RINOK(SendMessageError(callback, state.ErrorMessage, errorName));
    }
    if (callback)
      RINOK(callback->OperationResult(0));
  }

  return S_OK;
}
Exemplo n.º 16
0
Status ForEachFile(const PIVFS& fs, const VfsPath& startPath, FileCallback cb, uintptr_t cbData, const wchar_t* pattern, size_t flags)
{
	// (declare here to avoid reallocations)
	CFileInfos files;
	DirectoryNames subdirectoryNames;

	// (a FIFO queue is more efficient than recursion because it uses less
	// stack space and avoids seeks due to breadth-first traversal.)
	std::queue<VfsPath> pendingDirectories;
	pendingDirectories.push(startPath/"");
	while(!pendingDirectories.empty())
	{
		const VfsPath& path = pendingDirectories.front();

		RETURN_STATUS_IF_ERR(fs->GetDirectoryEntries(path, &files, &subdirectoryNames));

		for(size_t i = 0; i < files.size(); i++)
		{
			const CFileInfo fileInfo = files[i];
			if(!match_wildcard(fileInfo.Name().string().c_str(), pattern))
				continue;

			const VfsPath pathname(path / fileInfo.Name());	// (CFileInfo only stores the name)
			RETURN_STATUS_IF_ERR(cb(pathname, fileInfo, cbData));
		}

		if(!(flags & DIR_RECURSIVE))
			break;

		for(size_t i = 0; i < subdirectoryNames.size(); i++)
			pendingDirectories.push(path / subdirectoryNames[i]/"");
		pendingDirectories.pop();
	}

	return INFO::OK;
}
Exemplo n.º 17
0
IFilePtr CZipFileSystem::OpenFile(const CFileInfo& filePath, int mode)
{
    CFileInfo fileInfo(BasePath(), filePath.AbsolutePath(), false);
    IFilePtr file = FindFile(fileInfo);
    bool isExists = (file != nullptr);
    if (!isExists)
    {        
        file.reset(new CZipFile(fileInfo, m_Zip));
    }
    file->Open(mode);
    
    if (!isExists && file->IsOpened())
    {
        m_FileList.insert(file);
    }
    
    return file;
}
Exemplo n.º 18
0
bool DoesDirExist(CFSTR name)
{
  CFileInfo fi;
  return fi.Find(name) && fi.IsDir();
}
Exemplo n.º 19
0
bool CPanel::OnComboBoxCommand(UINT code, LPARAM /* param */, LRESULT &result)
{
  result = FALSE;
  switch (code)
  {
    case CBN_DROPDOWN:
    {
      ComboBoxPaths.Clear();
      _headerComboBox.ResetContent();
      
      unsigned i;
      UStringVector pathParts;
      
      SplitPathToParts(_currentFolderPrefix, pathParts);
      UString sumPass;
      if (!pathParts.IsEmpty())
        pathParts.DeleteBack();
      for (i = 0; i < pathParts.Size(); i++)
      {
        UString name = pathParts[i];
        sumPass += name;
        sumPass.Add_PathSepar();
        CFileInfo info;
        DWORD attrib = FILE_ATTRIBUTE_DIRECTORY;
        if (info.Find(us2fs(sumPass)))
          attrib = info.Attrib;
        AddComboBoxItem(name.IsEmpty() ? L"\\" : name, GetRealIconIndex(us2fs(sumPass), attrib), i, false);
        ComboBoxPaths.Add(sumPass);
      }

      #ifndef UNDER_CE

      int iconIndex;
      UString name;
      name = RootFolder_GetName_Documents(iconIndex);
      AddComboBoxItem(name, iconIndex, 0, true);

      name = RootFolder_GetName_Computer(iconIndex);
      AddComboBoxItem(name, iconIndex, 0, true);
        
      FStringVector driveStrings;
      MyGetLogicalDriveStrings(driveStrings);
      for (i = 0; i < driveStrings.Size(); i++)
      {
        FString s = driveStrings[i];
        ComboBoxPaths.Add(fs2us(s));
        int iconIndex = GetRealIconIndex(s, 0);
        if (s.Len() > 0 && s.Back() == FCHAR_PATH_SEPARATOR)
          s.DeleteBack();
        AddComboBoxItem(fs2us(s), iconIndex, 1, false);
      }

      name = RootFolder_GetName_Network(iconIndex);
      AddComboBoxItem(name, iconIndex, 0, true);

      #endif
    
      return false;
    }

    case CBN_SELENDOK:
    {
      code = code;
      int index = _headerComboBox.GetCurSel();
      if (index >= 0)
      {
        UString pass = ComboBoxPaths[index];
        _headerComboBox.SetCurSel(-1);
        // _headerComboBox.SetText(pass); // it's fix for seclecting by mouse.
        if (BindToPathAndRefresh(pass) == S_OK)
        {
          PostMsg(kSetFocusToListView);
          #ifdef UNDER_CE
          PostMsg(kRefresh_HeaderComboBox);
          #endif
          return true;
        }
      }
      return false;
    }
    /*
    case CBN_CLOSEUP:
    {
      LoadFullPathAndShow();
      true;

    }
    case CBN_SELCHANGE:
    {
      // LoadFullPathAndShow();
      return true;
    }
    */
  }
  return false;
}
Exemplo n.º 20
0
HRESULT CPanel::BindToPath(const UString &fullPath, const UString &arcFormat, bool &archiveIsOpened, bool &encrypted)
{
  UString path = fullPath;
  #ifdef _WIN32
  path.Replace(L'/', WCHAR_PATH_SEPARATOR);
  #endif

  archiveIsOpened = false;
  encrypted = false;
  
  CDisableTimerProcessing disableTimerProcessing(*this);
  CDisableNotify disableNotify(*this);

  for (; !_parentFolders.IsEmpty(); CloseOneLevel())
  {
    // ---------- we try to use open archive ----------

    const CFolderLink &link = _parentFolders.Back();
    const UString &virtPath = link.VirtualPath;
    if (!path.IsPrefixedBy(virtPath))
      continue;
    UString relatPath = path.Ptr(virtPath.Len());
    if (!relatPath.IsEmpty())
    {
      if (!IS_PATH_SEPAR(relatPath[0]))
        continue;
      else
        relatPath.Delete(0);
    }
    
    UString relatPath2 = relatPath;
    if (!relatPath2.IsEmpty() && !IS_PATH_SEPAR(relatPath2.Back()))
      relatPath2.Add_PathSepar();

    for (;;)
    {
      const UString foldPath = GetFolderPath(_folder);
      if (relatPath2 == foldPath)
        break;
      if (relatPath.IsPrefixedBy(foldPath))
      {
        path = relatPath.Ptr(foldPath.Len());
        break;
      }
      CMyComPtr<IFolderFolder> newFolder;
      if (_folder->BindToParentFolder(&newFolder) != S_OK)
        throw 20140918;
      if (!newFolder) // we exit from loop above if (relatPath.IsPrefixedBy(empty path for root folder)
        throw 20140918;
      SetNewFolder(newFolder);
    }
    break;
  }

  if (_parentFolders.IsEmpty())
  {
    // ---------- we open file or folder from file system ----------

    CloseOpenFolders();
    UString sysPath = path;
    
    unsigned prefixSize = NName::GetRootPrefixSize(sysPath);
    if (prefixSize == 0 || sysPath[prefixSize] == 0)
      sysPath.Empty();
    
    #if defined(_WIN32) && !defined(UNDER_CE)
    if (!sysPath.IsEmpty() && sysPath.Back() == ':' &&
      (sysPath.Len() != 2 || !NName::IsDrivePath2(sysPath)))
    {
      UString baseFile = sysPath;
      baseFile.DeleteBack();
      if (NFind::DoesFileOrDirExist(us2fs(baseFile)))
        sysPath.Empty();
    }
    #endif
    
    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)
    {
      SetNewFolder(newFolder);
      // LoadFullPath();
      return S_OK;
    }
  }
  
  {
    // ---------- we open folder remPath in archive and sub archives ----------

    for (unsigned curPos = 0; curPos != path.Len();)
    {
      UString s = path.Ptr(curPos);
      int slashPos = NName::FindSepar(s);
      unsigned skipLen = s.Len();
      if (slashPos >= 0)
      {
        s.DeleteFrom(slashPos);
        skipLen = slashPos + 1;
      }

      CMyComPtr<IFolderFolder> newFolder;
      _folder->BindToFolder(s, &newFolder);
      if (newFolder)
        curPos += skipLen;
      else if (_folderAltStreams)
      {
        int pos = s.Find(L':');
        if (pos >= 0)
        {
          UString baseName = s;
          baseName.DeleteFrom(pos);
          if (_folderAltStreams->BindToAltStreams(baseName, &newFolder) == S_OK && newFolder)
            curPos += pos + 1;
        }
      }
      
      if (!newFolder)
        break;

      SetNewFolder(newFolder);
    }
  }

  return S_OK;
}
Exemplo n.º 21
0
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);
          }
        }
      }
    }
  }
  return S_OK;
}
Exemplo n.º 22
0
// speed optimized and made unicode-compatible
inline bool CFilenameLayer::FilesEqual( CFileInfo & FileInfo1,  CFileInfo & FileInfo2) const
{
 
	switch (	 m_FilenameMatchMode )
 {
	case IDC_MATCH_FILENAMES:
		if ( m_CaseSensitive ) 
   return _tcscmp( FileInfo1.GetName() ,  FileInfo2.GetName() ) == 0;
		else
   return _tcsicmp( FileInfo1.GetName() ,  FileInfo2.GetName() ) == 0;

		break;
	case IDC_MATCH_EXTENSIONS:
		{
			LPCTSTR pExtension1, pExtension2;

			pExtension1 = FileInfo1.GetExtension();
			pExtension2 = FileInfo2.GetExtension();
  
			if ( pExtension1 == NULL || pExtension2 == NULL )
			{	
				return ( pExtension1 == pExtension2 );
			} 
			else
			{
				if ( m_CaseSensitive ) 
					return _tcscmp( pExtension1 , pExtension2 ) == 0;
				else
					return _tcsicmp( pExtension1 , pExtension2 ) == 0;
			}
		}
		break;
	case IDC_MATCH_NOT_FILENAME:
		if ( m_CaseSensitive ) 
   return _tcscmp( FileInfo1.GetName() ,  FileInfo2.GetName() ) != 0;
		else
   return _tcsicmp( FileInfo1.GetName() ,  FileInfo2.GetName() ) != 0;

		break;
	case IDC_MATCH_NOT_EXTENSIONS:
  {
			LPCTSTR pExtension1, pExtension2;

			pExtension1 = FileInfo1.GetExtension();
			pExtension2 = FileInfo2.GetExtension();
  
			if ( pExtension1 == NULL || pExtension2 == NULL )
			{	
				return ( pExtension1 == pExtension2 );
			} 
			else
			{
				if ( m_CaseSensitive ) 
					return _tcscmp( pExtension1 , pExtension2 ) != 0;
				else
					return _tcsicmp( pExtension1 , pExtension2 ) != 0;
			}
		}
		break;
	case IDC_MATCH_WORDS:
		{
		CArray <CString, CString&> Words1;
	 CArray <CString, CString&> Words2;
	 CArray <CString, CString> IgnoreWords;
  CString strMask;
		CString TempStr = FileInfo1.GetBaseName();
  int nPos = 0;	
		int nNextPos = 0;
		int x, y;
		
		nPos = 0;	
		nNextPos = 0;

		// add file masks
		while (nPos < TempStr.GetLength()) 
		{
			nNextPos = TempStr.Find( _T(" ") ,nPos);
			if (nNextPos == -1) nNextPos = TempStr.GetLength();
			strMask = TempStr.Mid(nPos, nNextPos-nPos);
			strMask.TrimLeft();
			strMask.TrimRight();
			if ( !m_CaseSensitive ) strMask.MakeUpper();
			if (strMask != "") Words1.Add(strMask);
			nPos = nNextPos + 1;
		}
		//

		TempStr = FileInfo2.GetBaseName();

		nPos = 0;	
		nNextPos = 0;

		// add file masks
		while (nPos < TempStr.GetLength()) 
		{
			nNextPos = TempStr.Find( _T(" ") ,nPos);
			if (nNextPos == -1) nNextPos = TempStr.GetLength();
			strMask = TempStr.Mid(nPos, nNextPos-nPos);
			strMask.TrimLeft();
			strMask.TrimRight();
			if ( !m_CaseSensitive ) strMask.MakeUpper();
			if (strMask != "") Words2.Add(strMask);
			nPos = nNextPos + 1;
		}
		//

		// remove duplicate words
  for (x = Words1.GetSize()-1; x > 0 ; x--)
		{
   for (y = x-1; y >= 0; y--)
	 	{
				if ( Words1.ElementAt(x) == Words1.ElementAt(y) ) 
				{
					Words1.RemoveAt(x);
				 break;
				}
			}
		}
		//

		// remove duplicate words
  for (x = Words2.GetSize()-1; x > 0 ; x--)
		{
   for (y = x-1; y >= 0; y--)
	 	{
				if ( Words2.ElementAt(x) == Words2.ElementAt(y) ) 
				{
					Words2.RemoveAt(x);
				 break;
				}
			}
		}
		//

  IgnoreWords.Add("-");
		IgnoreWords.Add("A");
		IgnoreWords.Add("THE");
		IgnoreWords.Add("I");
		IgnoreWords.Add("AT");
		IgnoreWords.Add("OF");
		IgnoreWords.Add("ON");

		bool deleted;

		// remove ignored words
		for (x = Words1.GetSize()-1; x>=0; x--)
		{
			deleted = false;
			y = 0;
			//for (y = 0; y < IgnoreWords.GetSize(); y++)
			while ( !deleted && y < IgnoreWords.GetSize() )
			{
				if ( Words1.ElementAt(x) == IgnoreWords.ElementAt(y) )
				{
					Words1.RemoveAt(x);
				 deleted = true;
				}
				y++;
			}
		}
  
		// remove ignored words
		for (x = Words2.GetSize()-1; x>=0; x--)
		{
			deleted = false;
			y = 0;
			//for (y = 0; y < IgnoreWords.GetSize(); y++)
			while ( !deleted && y < IgnoreWords.GetSize() )
			{
				if ( Words2.ElementAt(x) == IgnoreWords.ElementAt(y) )
				{
					Words2.RemoveAt(x);
				 deleted = true;
				}
				y++;
			}
		}

		UINT CommonCount = 0;
		// calculate the number of common words
		for (x = 0; x < Words1.GetSize(); x++)
		{
			for (y = 0; y < Words2.GetSize(); y++)
			{
				if ( Words1.ElementAt(x) == Words2.ElementAt(y) )
					CommonCount++;
			}
		}

		return ( CommonCount >= m_WordCount );
		}
		break;

	default:
		AfxMessageBox( _T("FMM_ERROR") );
		return true;
		break;
	}

	
/*
 // not optimized

 CString File1, File2;
	
	File1 = FileInfo1.Filename.Right( FileInfo1.Filename.GetLength() - FileInfo1.Filename.ReverseFind('\\') - 1 );
 File2 = FileInfo2.Filename.Right( FileInfo2.Filename.GetLength() - FileInfo2.Filename.ReverseFind('\\') - 1 );
	
 if ( !m_FilenameLayerForm.m_CaseSensitive )
	{
		File1.MakeUpper();
		File2.MakeUpper();
	}


	switch (	 m_FilenameMatchMode )
 {
	case IDC_MATCH_FILENAMES:
		return File1 == File2;
		break;
	case IDC_MATCH_EXTENSIONS:
		return File1.Right( File1.GetLength() - File1.ReverseFind('.') - 1 ) == File2.Right( File2.GetLength() - File2.ReverseFind('.') - 1);
		break;
 case IDC_MATCH_NOTHING:
		return true;
		break;
	case IDC_MATCH_NOT_FILENAME:
		return File1 != File2;
		break;
	case IDC_MATCH_NOT_EXTENSIONS:
		return File1.Right( File1.GetLength() - File1.ReverseFind('.') - 1 ) != File2.Right( File2.GetLength() - File2.ReverseFind('.') - 1);
		break;
	default:
		AfxMessageBox("FMM_ERROR");
		return true;
		break;
	}

*/

}
Exemplo n.º 23
0
UINT CFileEvent::FileEventProc (LPVOID lpParam)
  {
    CFileEvent *pFileEvent = (CFileEvent*) lpParam;
    int nFilePathCount = pFileEvent->m_lstFilePath.GetCount ();
    HANDLE *phChanges = new HANDLE[nFilePathCount + 1];
    for (int i;;)
      {
        *phChanges = pFileEvent->m_evWatching;
        POSITION pos = pos = pFileEvent->m_lstFilePath.GetHeadPosition ();
        CFilePath *pFilePath;
        int j = 0;
        for (i = 0; i < nFilePathCount; i++)
          {
            if (!pos)
              {
                nFilePathCount = i;
                break;
              }
            pFilePath = pFileEvent->m_lstFilePath.GetNext (pos);
            ASSERT (pFilePath);
            HANDLE hFC = FindFirstChangeNotification (pFilePath->GetPath(), FALSE,
              FILE_NOTIFY_CHANGE_LAST_WRITE|FILE_NOTIFY_CHANGE_SIZE|FILE_NOTIFY_CHANGE_FILE_NAME);
            if (hFC != INVALID_HANDLE_VALUE) // if i can gen a notification --
              phChanges[++j] = hFC;
          }
        DWORD dwResult = WaitForMultipleObjects (j + 1, phChanges, FALSE, INFINITE);
        for (i = 1; i < j; i++)
          VERIFY (FindCloseChangeNotification (phChanges[i + 1]));
        if (dwResult == WAIT_OBJECT_0)
          break;
        int nPath = dwResult - WAIT_OBJECT_0 - 1;
        pos = pFileEvent->m_lstFilePath.FindIndex (nPath);
        //ASSERT (pos);
		if(pos == 0)
		{
			break;
		}
        pFilePath = pFileEvent->m_lstFilePath.GetAt (pos);
        //ASSERT (pFilePath);
		if(pFilePath == NULL)
		{
			break;
		}
        CString sPathName;
        CFileInfo *pFileInfo;
        for (pos = pFileEvent->m_mapFileInfo.GetStartPosition (); pos;)
          {
            pFileEvent->m_mapFileInfo.GetNextAssoc (pos, sPathName, pFileInfo);
            ASSERT (pFileInfo);
            if (!_tcscmp (pFilePath->GetPath (), pFileInfo->GetPath ()))
              {
                HANDLE hFile = CreateFile (sPathName, GENERIC_READ, FILE_SHARE_READ /*|FILE_SHARE_WRITE|FILE_SHARE_DELETE*/,
                  NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
				// add at 2006-05-06 by blueant
				if (hFile == INVALID_HANDLE_VALUE)
				{
					// 文件保存过程中很大情况下返回的是无效句柄,需要延迟一段时间等保存完毕再打开
					Sleep(50);
					hFile = CreateFile (sPathName, GENERIC_READ, FILE_SHARE_READ /*|FILE_SHARE_WRITE|FILE_SHARE_DELETE*/,
						NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
				}
                if (hFile != INVALID_HANDLE_VALUE)
                  {
                    FILETIME ftModified;
                    VERIFY (GetFileTime (hFile, NULL, NULL, &ftModified));
                    DWORD dwSize;
					// ->HE
					dwSize= GetFileSize (hFile, NULL);
					ASSERT(dwSize != (DWORD)-1);
					// <-HE
                   CloseHandle (hFile);
                    WPARAM wEvent = FE_NONE;
                    if (CompareFileTime (&pFileInfo->GetModified (), &ftModified) < 0)
                      {
                        pFileInfo->SetModified (ftModified);
                        wEvent |= FE_CHANGED_TIME;
                      }
                    if (pFileInfo->GetSize () != dwSize)
                      {
                        pFileInfo->SetSize (dwSize);
                        wEvent |= FE_CHANGED_SIZE;
                      }
                    if (wEvent)
                      pFileEvent->OnFileEvent (wEvent, sPathName);
                  }
                else
                  {
                    pFileEvent->OnFileEvent (FE_DELETED, sPathName);
                    pFileEvent->RemoveFile (sPathName);
                  }
              }
          }
      }
    delete [] phChanges;
    return 0;
  }
Exemplo n.º 24
0
void CFileMoveProcess::ProcessFiles ( CList<CFileInfo *, CFileInfo *> & FileList)
{
 CString Msg;
	SHFILEOPSTRUCT fos;
 TCHAR pDirBuffer[MAX_PATH];
 TCHAR pFilenameBuffer[MAX_PATH];
 CFileInfo * pFileInfo;
 POSITION ListPos;

	// setup to directory buffer
// pDirBuffer = new TCHAR[m_Dir.GetLength()+2];
 strcpy( pDirBuffer, (LPCSTR) m_Dir);
 pDirBuffer[m_Dir.GetLength()] = '\0';
 pDirBuffer[m_Dir.GetLength()+1] = '\0';
 //

	// setup struct
 fos.hwnd = AfxGetMainWnd()->m_hWnd;
 fos.wFunc= FO_MOVE;
	fos.pTo =  pDirBuffer;
	fos.fFlags = FOF_ALLOWUNDO | FOF_NOERRORUI;
	fos.lpszProgressTitle = "NULL";
 //
	
	// set confirmation flag
	if ( m_YesToAll ) fos.fFlags |= FOF_NOCONFIRMATION;
 //


	/*	for ( int i = 0; i < FileList.GetSize(); i++)
		{
			//if ( ((CDuffDlg*)GetParent()->GetParent())->m_DuplicatePage.m_DupeList.GetCheck(i) == BST_CHECKED )
			//{
				Temp = FileList.ElementAt(i).m_Filename;
				//TotalLength += Temp.GetLength() +1;
				FilesToDelete.Add(Temp);
			//}
		}
		*/


 // update progress information
	pDuffStatus->Lock();
	pDuffStatus->CurrentTaskStr = "Moving selected duplicate files...";
	pDuffStatus->CurrentTaskInfo = "";
	pDuffStatus->SubProgress1.Min = 0;
	pDuffStatus->SubProgress1.Pos = 0;
	pDuffStatus->SubProgress1.Max = FileList.GetCount();
	pDuffStatus->Unlock();
	//


	ListPos = FileList.GetHeadPosition();

	while (ListPos)
	{
		pFileInfo = FileList.GetAt(ListPos);

		// process only the selected files
		if ( pFileInfo->Selected)
		{
			if ( ! (pFileInfo->Attributes & FILE_ATTRIBUTE_READONLY)  || m_MoveReadOnly )
			{

				/*				// remove read-only attribute
			 if ( FileList.ElementAt(i)->ReadOnly )
			 {
			 	DWORD FileAttributes;
			 	FileAttributes = GetFileAttributes( FileList.ElementAt(i)->Filename )
			 	FileAttributes ^= FILE_ATTRIBUTE_READONLY;
     SetFileAttributes(FileList.ElementAt(i)->Filename,FileAttributes );
			 }*/

	
			 _tcscpy(pFilenameBuffer, pFileInfo->GetFullName() );

    UINT			Length = _tcslen( pFilenameBuffer );

			//		for (int x = 0; x < FileList.ElementAt(i)->Filename.GetLength(); x++)
	//		{
		//		pFilenameBuffer[x] = FileList.ElementAt(i)->Filename.GetAt(x);
		//	}

		 	pFilenameBuffer[Length] = 0;
		 	pFilenameBuffer[Length+1] = 0;

			 fos.pFrom = pFilenameBuffer;

			 //		g_DupeFileFind.GetDuffDlg()->m_CurrentTaskInfoText.SetWindowText(FileList.ElementAt(i)->GetFullName());
	   //		g_DupeFileFind.GetDuffDlg()->m_CurrentTaskInfoText.RedrawWindow();

		 	// update progress information
		  pDuffStatus->Lock();
		  pDuffStatus->CurrentTaskInfo = pFileInfo->GetFullName();
		  pDuffStatus->SubProgress1.Pos++;
		  pDuffStatus->Unlock();
		  //

			
		 	/*	
		 	Msg.Format("Moving:\n%s\nto:\n%s",FileList.ElementAt(i)->m_Filename,fos.pTo);
		 	MessageBox(NULL,Msg,"FYI",MB_OK);
	   */

				if	( SHFileOperation(&fos) )
				{
					Msg.Format("ERROR moving file: %s to %s",pFileInfo->GetFullName(),m_Dir);
		//			g_DupeFileFind.GetDuffDlg()->Log(Msg);
				}
				else
				{
					Msg.Format("Moved file: %s to %s",pFileInfo->GetFullName(),m_Dir);
	//				g_DupeFileFind.GetDuffDlg()->Log(Msg);
				}
		//		g_DupeFileFind.GetDuffDlg()->m_ProgressEntire.StepIt();
	//			delete []pFilenameBuffer;
			}

		}

		FileList.GetNext(ListPos);
	}				
//	delete[] pDirBuffer;

}
Exemplo n.º 25
0
bool CZipFileSystem::IsFileExists(const CFileInfo& filePath) const
{
    return (FindFile(BasePath() + filePath.AbsolutePath()) != nullptr);
}
Exemplo n.º 26
0
bool DoesFileExist(LPCTSTR name)
{
  CFileInfo fi;
  return fi.Find(name) && !fi.IsDir();
}
Exemplo n.º 27
0
void CLodArchiveLoader::open(const CFileInfo & archive)
{
	open(archive.getName());
}
Exemplo n.º 28
0
bool DoesFileOrDirExist(CFSTR name)
{
  CFileInfo fi;
  return fi.Find(name);
}
STDMETHODIMP CAltStreamsFolder::CopyTo(Int32 moveMode, const UInt32 *indices, UInt32 numItems,
    Int32 /* includeAltStreams */, Int32 /* replaceAltStreamColon */,
    const wchar_t *path, IFolderOperationsExtractCallback *callback)
{
  if (numItems == 0)
    return S_OK;

  /*
  CMyComPtr<IFolderExtractToStreamCallback> ExtractToStreamCallback;
  RINOK(callback->QueryInterface(IID_IFolderExtractToStreamCallback, (void **)&ExtractToStreamCallback));
  if (ExtractToStreamCallback)
  {
    Int32 useStreams = 0;
    if (ExtractToStreamCallback->UseExtractToStream(&useStreams) != S_OK)
      useStreams = 0;
    if (useStreams == 0)
      ExtractToStreamCallback.Release();
  }
  */

  UInt64 totalSize = 0;
  {
    UInt32 i;
    for (i = 0; i < numItems; i++)
    {
      totalSize += Streams[indices[i]].Size;
    }
    RINOK(callback->SetTotal(totalSize));
    RINOK(callback->SetNumFiles(numItems));
  }

  /*
  if (ExtractToStreamCallback)
  {
    CGetProp *GetProp_Spec = new CGetProp;
    CMyComPtr<IGetProp> GetProp= GetProp_Spec;

    for (UInt32 i = 0; i < numItems; i++)
    {
      UInt32 index = indices[i];
      const CAltStream &ss = Streams[index];
      GetProp_Spec->Name = ss.Name;
      GetProp_Spec->Size = ss.Size;
      CMyComPtr<ISequentialOutStream> outStream;
      RINOK(ExtractToStreamCallback->GetStream7(GetProp_Spec->Name, BoolToInt(false), &outStream,
        NArchive::NExtract::NAskMode::kExtract, GetProp)); // isDir
      FString srcPath;
      GetFullPath(ss, srcPath);
      RINOK(ExtractToStreamCallback->PrepareOperation7(NArchive::NExtract::NAskMode::kExtract));
      RINOK(ExtractToStreamCallback->SetOperationResult7(NArchive::NExtract::NOperationResult::kOK, BoolToInt(false))); // _encrypted
      // RINOK(CopyStream(state, srcPath, fi, ss, destPath2, callback, completedSize));
    }
    return S_OK;
  }
  */

  FString destPath = us2fs(path);
  if (destPath.IsEmpty() /* && !ExtractToStreamCallback */)
    return E_INVALIDARG;

  bool isAltDest = NName::IsAltPathPrefix(destPath);;
  bool isDirectPath = (!isAltDest && !IsPathSepar(destPath.Back()));

  if (isDirectPath)
  {
    if (numItems > 1)
      return E_INVALIDARG;
  }

  CFileInfo fi;
  if (!fi.Find(_pathBaseFile))
    return GetLastError();

  NFsFolder::CCopyStateIO state;
  state.Progress = callback;
  state.DeleteSrcFile = IntToBool(moveMode);
  state.TotalSize = totalSize;

  for (UInt32 i = 0; i < numItems; i++)
  {
    UInt32 index = indices[i];
    const CAltStream &ss = Streams[index];
    FString destPath2 = destPath;
    if (!isDirectPath)
      destPath2 += us2fs(Get_Correct_FsFile_Name(ss.Name));
    FString srcPath;
    GetFullPath(ss, srcPath);
    RINOK(CopyStream(state, srcPath, fi, ss, destPath2, callback));
  }

  return S_OK;
}