Index: src/ch/TLocalFilesystem.cpp =================================================================== diff -u -N -r7749d67cd70821fef9cc51303d42625fbcc2aa9d -ra3800c2f65fa66354e072b34c9e9970af49236b6 --- src/ch/TLocalFilesystem.cpp (.../TLocalFilesystem.cpp) (revision 7749d67cd70821fef9cc51303d42625fbcc2aa9d) +++ src/ch/TLocalFilesystem.cpp (.../TLocalFilesystem.cpp) (revision a3800c2f65fa66354e072b34c9e9970af49236b6) @@ -117,6 +117,11 @@ return ::CreateDirectory(PrependPathExtensionIfNeeded(pathDirectory).ToString(), NULL) != FALSE; } +bool TLocalFilesystem::RemoveDirectory(const chcore::TSmartPath& pathFile) +{ + return ::RemoveDirectory(PrependPathExtensionIfNeeded(pathFile).ToString()) != FALSE; +} + bool TLocalFilesystem::DeleteFile(const chcore::TSmartPath& pathFile) { return ::DeleteFile(PrependPathExtensionIfNeeded(pathFile).ToString()) != FALSE; Index: src/ch/TLocalFilesystem.h =================================================================== diff -u -N -r7749d67cd70821fef9cc51303d42625fbcc2aa9d -ra3800c2f65fa66354e072b34c9e9970af49236b6 --- src/ch/TLocalFilesystem.h (.../TLocalFilesystem.h) (revision 7749d67cd70821fef9cc51303d42625fbcc2aa9d) +++ src/ch/TLocalFilesystem.h (.../TLocalFilesystem.h) (revision a3800c2f65fa66354e072b34c9e9970af49236b6) @@ -43,6 +43,7 @@ static bool SetAttributes(const chcore::TSmartPath& pathFileDir, DWORD dwAttributes); static bool CreateDirectory(const chcore::TSmartPath& pathDirectory); + static bool RemoveDirectory(const chcore::TSmartPath& pathFile); 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); Index: src/ch/TSubTaskBase.cpp =================================================================== diff -u -N -r6e8aa26e2428e3bc71099255c5911f57bc722100 -ra3800c2f65fa66354e072b34c9e9970af49236b6 --- src/ch/TSubTaskBase.cpp (.../TSubTaskBase.cpp) (revision 6e8aa26e2428e3bc71099255c5911f57bc722100) +++ src/ch/TSubTaskBase.cpp (.../TSubTaskBase.cpp) (revision a3800c2f65fa66354e072b34c9e9970af49236b6) @@ -66,7 +66,6 @@ return iDriveNumber; } - chcore::TSmartPath TSubTaskBase::CalculateDestinationPath(const CFileInfoPtr& spFileInfo, chcore::TSmartPath pathDst, int iFlags) const { const TBasePathDataContainer& rSourcePathsInfo = GetContext().GetBasePathDataContainer(); @@ -75,7 +74,7 @@ THROW(_T("Invalid pointer"), 0, 0, 0); // iFlags: bit 0-ignore folders; bit 1-force creating directories - if (iFlags & 0x02) + if(iFlags & 0x02) { // force create directories chcore::TSmartPath pathCombined = pathDst + spFileInfo->GetFullFilePath().GetFileDir(); @@ -123,7 +122,7 @@ chcore::TSmartPath pathCheckPath(chcore::PathFromString((PCTSTR)fmt)); // when adding to strDstPath check if the path already exists - if so - try again - int iCounter=1; + int iCounter = 1; CString strFmt = GetTaskPropValue(rTaskDefinition.GetConfiguration()); while(TLocalFilesystem::PathExist(pathDstPath + pathCheckPath)) { Index: src/ch/TSubTaskDelete.cpp =================================================================== diff -u -N -rc866a5e96f5eaf160278a8c128bf86e342cc2409 -ra3800c2f65fa66354e072b34c9e9970af49236b6 --- src/ch/TSubTaskDelete.cpp (.../TSubTaskDelete.cpp) (revision c866a5e96f5eaf160278a8c128bf86e342cc2409) +++ src/ch/TSubTaskDelete.cpp (.../TSubTaskDelete.cpp) (revision a3800c2f65fa66354e072b34c9e9970af49236b6) @@ -28,6 +28,7 @@ #include "TTaskConfiguration.h" #include "TTaskDefinition.h" #include "FeedbackHandler.h" +#include "TLocalFilesystem.h" TSubTaskDelete::TSubTaskDelete(TSubTaskContext& rContext) : TSubTaskBase(rContext) @@ -79,19 +80,19 @@ if(spFileInfo->IsDirectory()) { if(!GetTaskPropValue(rTaskDefinition.GetConfiguration())) - SetFileAttributes(spFileInfo->GetFullFilePath().ToString(), FILE_ATTRIBUTE_NORMAL | FILE_ATTRIBUTE_DIRECTORY); - bSuccess=RemoveDirectory(spFileInfo->GetFullFilePath().ToString()); + TLocalFilesystem::SetAttributes(spFileInfo->GetFullFilePath(), FILE_ATTRIBUTE_NORMAL | FILE_ATTRIBUTE_DIRECTORY); + bSuccess = TLocalFilesystem::RemoveDirectory(spFileInfo->GetFullFilePath()); } else { // set files attributes to normal - it'd slow processing a bit, but it's better. if(!GetTaskPropValue(rTaskDefinition.GetConfiguration())) - SetFileAttributes(spFileInfo->GetFullFilePath().ToString(), FILE_ATTRIBUTE_NORMAL); - bSuccess=DeleteFile(spFileInfo->GetFullFilePath().ToString()); + TLocalFilesystem::SetAttributes(spFileInfo->GetFullFilePath(), FILE_ATTRIBUTE_NORMAL); + bSuccess = TLocalFilesystem::DeleteFile(spFileInfo->GetFullFilePath()); } // operation failed - DWORD dwLastError=GetLastError(); + DWORD dwLastError = GetLastError(); if(!bSuccess && dwLastError != ERROR_PATH_NOT_FOUND && dwLastError != ERROR_FILE_NOT_FOUND) { // log