Index: src/ch/TLocalFilesystem.cpp =================================================================== diff -u -N -r1456ff2ae4a98c83f18d20dc253a24f26ddf521d -r28b540c17739ad8b63f3b199e0e2151ec048bd05 --- src/ch/TLocalFilesystem.cpp (.../TLocalFilesystem.cpp) (revision 1456ff2ae4a98c83f18d20dc253a24f26ddf521d) +++ src/ch/TLocalFilesystem.cpp (.../TLocalFilesystem.cpp) (revision 28b540c17739ad8b63f3b199e0e2151ec048bd05) @@ -105,11 +105,21 @@ return bResult != FALSE; } +bool TLocalFilesystem::SetAttributes(const chcore::TSmartPath& pathFileDir, DWORD dwAttributes) +{ + return ::SetFileAttributes(PrependPathExtensionIfNeeded(pathFileDir).ToString(), dwAttributes) != FALSE; +} + bool TLocalFilesystem::CreateDirectory(const chcore::TSmartPath& pathDirectory) { return ::CreateDirectory(PrependPathExtensionIfNeeded(pathDirectory).ToString(), NULL) != FALSE; } +bool TLocalFilesystem::DeleteFile(const chcore::TSmartPath& pathFile) +{ + return ::DeleteFile(PrependPathExtensionIfNeeded(pathFile).ToString()) != FALSE; +} + bool TLocalFilesystem::GetFileInfo(const chcore::TSmartPath& pathFile, CFileInfoPtr& rFileInfo, size_t stSrcIndex, const chcore::TPathContainer* pBasePaths) { if(!rFileInfo) Index: src/ch/TLocalFilesystem.h =================================================================== diff -u -N -r1456ff2ae4a98c83f18d20dc253a24f26ddf521d -r28b540c17739ad8b63f3b199e0e2151ec048bd05 --- src/ch/TLocalFilesystem.h (.../TLocalFilesystem.h) (revision 1456ff2ae4a98c83f18d20dc253a24f26ddf521d) +++ src/ch/TLocalFilesystem.h (.../TLocalFilesystem.h) (revision 28b540c17739ad8b63f3b199e0e2151ec048bd05) @@ -35,8 +35,12 @@ public: static void GetDriveData(const chcore::TSmartPath& spPath, int *piDrvNum, UINT *puiDrvType); static bool PathExist(chcore::TSmartPath strPath); // check for file or folder existence + static bool SetFileDirectoryTime(const chcore::TSmartPath& pathFileDir, const FILETIME& ftCreationTime, const FILETIME& ftLastAccessTime, const FILETIME& ftLastWriteTime); + static bool SetAttributes(const chcore::TSmartPath& pathFileDir, DWORD dwAttributes); + static bool CreateDirectory(const chcore::TSmartPath& pathDirectory); + static bool DeleteFile(const chcore::TSmartPath& pathFile); static bool GetFileInfo(const chcore::TSmartPath& pathFile, CFileInfoPtr& rFileInfo, size_t stSrcIndex = std::numeric_limits::max(), const chcore::TPathContainer* pBasePaths = NULL); static bool FastMove(const chcore::TSmartPath& pathSource, const chcore::TSmartPath& pathDestination); Index: src/ch/TSubTaskCopyMove.cpp =================================================================== diff -u -N -r1456ff2ae4a98c83f18d20dc253a24f26ddf521d -r28b540c17739ad8b63f3b199e0e2151ec048bd05 --- src/ch/TSubTaskCopyMove.cpp (.../TSubTaskCopyMove.cpp) (revision 1456ff2ae4a98c83f18d20dc253a24f26ddf521d) +++ src/ch/TSubTaskCopyMove.cpp (.../TSubTaskCopyMove.cpp) (revision 28b540c17739ad8b63f3b199e0e2151ec048bd05) @@ -217,7 +217,7 @@ ccp.spSrcFile = spFileInfo; ccp.bProcessed = false; - // kopiuj dane + // copy data TSubTaskBase::ESubOperationResult eResult = CustomCopyFileFB(&ccp); if(eResult != TSubTaskBase::eSubResult_Continue) return eResult; @@ -228,8 +228,8 @@ if(bMove && spFileInfo->GetFlags() & FIF_PROCESSED && !GetTaskPropValue(rTaskDefinition.GetConfiguration())) { if(!GetTaskPropValue(rTaskDefinition.GetConfiguration())) - SetFileAttributes(spFileInfo->GetFullFilePath().ToString(), FILE_ATTRIBUTE_NORMAL); - DeleteFile(spFileInfo->GetFullFilePath().ToString()); // there will be another try later, so I don't check + TLocalFilesystem::SetAttributes(spFileInfo->GetFullFilePath(), FILE_ATTRIBUTE_NORMAL); + TLocalFilesystem::DeleteFile(spFileInfo->GetFullFilePath()); // there will be another try later, so I don't check // if succeeded } } @@ -240,7 +240,7 @@ // attributes if(GetTaskPropValue(rTaskDefinition.GetConfiguration())) - SetFileAttributes(ccp.pathDstFile.ToString(), spFileInfo->GetAttributes()); // as above + TLocalFilesystem::SetAttributes(ccp.pathDstFile, spFileInfo->GetAttributes()); // as above } rBasicProgressInfo.SetCurrentIndex(stIndex + 1); Index: src/ch/TSubTaskCopyMove.h =================================================================== diff -u -N -re30c2b40bd1b533d8740edc88d80b2fb340f3466 -r28b540c17739ad8b63f3b199e0e2151ec048bd05 --- src/ch/TSubTaskCopyMove.h (.../TSubTaskCopyMove.h) (revision e30c2b40bd1b533d8740edc88d80b2fb340f3466) +++ src/ch/TSubTaskCopyMove.h (.../TSubTaskCopyMove.h) (revision 28b540c17739ad8b63f3b199e0e2151ec048bd05) @@ -36,23 +36,22 @@ ESubOperationResult Exec(); - ESubOperationResult CreateDirectoryFB(const chcore::TSmartPath& pathDirectory); - private: bool GetMove(const CFileInfoPtr& spFileInfo); int GetBufferIndex(const CFileInfoPtr& spFileInfo); - TSubTaskBase::ESubOperationResult CustomCopyFileFB(CUSTOM_COPY_PARAMS* pData); + ESubOperationResult CustomCopyFileFB(CUSTOM_COPY_PARAMS* pData); - TSubTaskBase::ESubOperationResult OpenSourceFileFB(TAutoFileHandle& hFile, const CFileInfoPtr& spSrcFileInfo, bool bNoBuffering); - TSubTaskBase::ESubOperationResult OpenDestinationFileFB(TAutoFileHandle& hFile, const chcore::TSmartPath& pathDstFile, bool bNoBuffering, const CFileInfoPtr& spSrcFileInfo, unsigned long long& ullSeekTo, bool& bFreshlyCreated); - TSubTaskBase::ESubOperationResult OpenExistingDestinationFileFB(TAutoFileHandle& hFile, const chcore::TSmartPath& pathDstFilePath, bool bNoBuffering); + ESubOperationResult OpenSourceFileFB(TAutoFileHandle& hFile, const CFileInfoPtr& spSrcFileInfo, bool bNoBuffering); + ESubOperationResult OpenDestinationFileFB(TAutoFileHandle& hFile, const chcore::TSmartPath& pathDstFile, bool bNoBuffering, const CFileInfoPtr& spSrcFileInfo, unsigned long long& ullSeekTo, bool& bFreshlyCreated); + ESubOperationResult OpenExistingDestinationFileFB(TAutoFileHandle& hFile, const chcore::TSmartPath& pathDstFilePath, bool bNoBuffering); - TSubTaskBase::ESubOperationResult SetFilePointerFB(HANDLE hFile, long long llDistance, const chcore::TSmartPath& pathFile, bool& bSkip); - TSubTaskBase::ESubOperationResult SetEndOfFileFB(HANDLE hFile, const chcore::TSmartPath& pathFile, bool& bSkip); + ESubOperationResult SetFilePointerFB(HANDLE hFile, long long llDistance, const chcore::TSmartPath& pathFile, bool& bSkip); + ESubOperationResult SetEndOfFileFB(HANDLE hFile, const chcore::TSmartPath& pathFile, bool& bSkip); - TSubTaskBase::ESubOperationResult ReadFileFB(HANDLE hFile, CDataBuffer& rBuffer, DWORD dwToRead, DWORD& rdwBytesRead, const chcore::TSmartPath& pathFile, bool& bSkip); - TSubTaskBase::ESubOperationResult WriteFileFB(HANDLE hFile, CDataBuffer& rBuffer, DWORD dwToWrite, DWORD& rdwBytesWritten, const chcore::TSmartPath& pathFile, bool& bSkip); + ESubOperationResult ReadFileFB(HANDLE hFile, CDataBuffer& rBuffer, DWORD dwToRead, DWORD& rdwBytesRead, const chcore::TSmartPath& pathFile, bool& bSkip); + ESubOperationResult WriteFileFB(HANDLE hFile, CDataBuffer& rBuffer, DWORD dwToWrite, DWORD& rdwBytesWritten, const chcore::TSmartPath& pathFile, bool& bSkip); + ESubOperationResult CreateDirectoryFB(const chcore::TSmartPath& pathDirectory); }; #endif