Index: src/libchcore/TFilesystemFeedbackWrapper.cpp =================================================================== diff -u -N -r89f857792bba8752de98ddd477949e45cef5ba5a -rd3b1a109f2ace158e828715205592615d6e33fd0 --- src/libchcore/TFilesystemFeedbackWrapper.cpp (.../TFilesystemFeedbackWrapper.cpp) (revision 89f857792bba8752de98ddd477949e45cef5ba5a) +++ src/libchcore/TFilesystemFeedbackWrapper.cpp (.../TFilesystemFeedbackWrapper.cpp) (revision d3b1a109f2ace158e828715205592615d6e33fd0) @@ -197,21 +197,14 @@ do { bRetry = false; + DWORD dwLastError = ERROR_SUCCESS; - // #bug - changing read-only attribute should only be done when user explicitly requests it (via feedback response) - // for now it is ignored try { - if (!bProtectReadOnlyFiles) - m_spFilesystem->SetAttributes(spFileInfo->GetFullFilePath(), FILE_ATTRIBUTE_NORMAL | FILE_ATTRIBUTE_DIRECTORY); - } - catch (const TFileException&) - { - } + DWORD dwAttributes = spFileInfo->GetAttributes(); + if((dwAttributes & FILE_ATTRIBUTE_READONLY) && !bProtectReadOnlyFiles) + m_spFilesystem->SetAttributes(spFileInfo->GetFullFilePath(), dwAttributes & ~FILE_ATTRIBUTE_READONLY); - DWORD dwLastError = ERROR_SUCCESS; - try - { m_spFilesystem->RemoveDirectory(spFileInfo->GetFullFilePath()); return TSubTaskBase::eSubResult_Continue; } @@ -220,11 +213,11 @@ dwLastError = e.GetNativeError(); } - if (dwLastError == ERROR_PATH_NOT_FOUND || dwLastError == ERROR_FILE_NOT_FOUND) + if(dwLastError == ERROR_PATH_NOT_FOUND || dwLastError == ERROR_FILE_NOT_FOUND) return TSubTaskBase::eSubResult_Continue; // log - TString strFormat = _T("Error #%errno while deleting file/folder %path"); + TString strFormat = _T("Error #%errno while deleting folder %path"); strFormat.Replace(_T("%errno"), boost::lexical_cast(dwLastError).c_str()); strFormat.Replace(_T("%path"), spFileInfo->GetFullFilePath().ToString()); m_rLog.loge(strFormat.c_str()); @@ -266,20 +259,13 @@ { bRetry = false; - // #bug - changing read-only attribute should only be done when user explicitly requests it (via feedback response) - // for now it is ignored - try - { - if (!bProtectReadOnlyFiles) - m_spFilesystem->SetAttributes(spFileInfo->GetFullFilePath(), FILE_ATTRIBUTE_NORMAL | FILE_ATTRIBUTE_DIRECTORY); - } - catch (const TFileException&) - { - } - DWORD dwLastError = ERROR_SUCCESS; try { + DWORD dwAttributes = spFileInfo->GetAttributes(); + if((dwAttributes & FILE_ATTRIBUTE_READONLY) && !bProtectReadOnlyFiles) + m_spFilesystem->SetAttributes(spFileInfo->GetFullFilePath(), dwAttributes & ~FILE_ATTRIBUTE_READONLY); + m_spFilesystem->DeleteFile(spFileInfo->GetFullFilePath()); return TSubTaskBase::eSubResult_Continue; } @@ -292,7 +278,7 @@ return TSubTaskBase::eSubResult_Continue; // log - TString strFormat = _T("Error #%errno while deleting file/folder %path"); + TString strFormat = _T("Error #%errno while deleting file %path"); strFormat.Replace(_T("%errno"), boost::lexical_cast(dwLastError).c_str()); strFormat.Replace(_T("%path"), spFileInfo->GetFullFilePath().ToString()); m_rLog.loge(strFormat.c_str());