Index: src/ch/FileInfo.cpp =================================================================== diff -u -r4c272b19c74694c428c943011f279ec064fbd894 -r41fe62040d243a82461acabdad942307d7c9045f --- src/ch/FileInfo.cpp (.../FileInfo.cpp) (revision 4c272b19c74694c428c943011f279ec064fbd894) +++ src/ch/FileInfo.cpp (.../FileInfo.cpp) (revision 41fe62040d243a82461acabdad942307d7c9045f) @@ -654,6 +654,7 @@ m_timCreation = finf.m_timCreation; m_timLastAccess = finf.m_timLastAccess; m_timLastWrite = finf.m_timLastWrite; + m_uiFlags = finf.m_uiFlags; m_pClipboard=finf.m_pClipboard; } @@ -702,6 +703,7 @@ m_timCreation = pwfd->ftCreationTime; m_timLastAccess = pwfd->ftLastAccessTime; m_timLastWrite = pwfd->ftLastWriteTime; + m_uiFlags = 0; } bool CFileInfo::Create(CString strFilePath, int iSrcIndex) @@ -730,6 +732,7 @@ m_timCreation.SetDateTime(1900, 1, 1, 0, 0, 0); m_timLastAccess.SetDateTime(1900, 1, 1, 0, 0, 0); m_timLastWrite.SetDateTime(1900, 1, 1, 0, 0, 0); + m_uiFlags = 0; return false; } } @@ -859,6 +862,7 @@ ar>>m_timCreation; ar>>m_timLastAccess; ar>>m_timLastWrite; + m_uiFlags = 0; } bool CFileInfo::operator==(const CFileInfo& rInfo) Index: src/ch/FileInfo.h =================================================================== diff -u -r025757ce5252abbb6dfd81f8f254e419f9520a09 -r41fe62040d243a82461acabdad942307d7c9045f --- src/ch/FileInfo.h (.../FileInfo.h) (revision 025757ce5252abbb6dfd81f8f254e419f9520a09) +++ src/ch/FileInfo.h (.../FileInfo.h) (revision 41fe62040d243a82461acabdad942307d7c9045f) @@ -70,6 +70,10 @@ #define DATE_MODIFIED 1 #define DATE_LASTACCESSED 2 +// CFileInfo flags +// flag stating that file has been processed (used to determine if file can be deleted at the end of copying) +#define FIF_PROCESSED 0x00000001 + class CFileInfo; class CFileFilter @@ -241,6 +245,9 @@ bool IsTemporary(void) const { return (m_dwAttributes & FILE_ATTRIBUTE_TEMPORARY) != 0; }; /** @cmember Returns TRUE if the file is temporary */ bool IsNormal(void) const { return m_dwAttributes == 0; }; /** @cmember Returns TRUE if the file is a normal file */ + uint_t GetFlags() const { return m_uiFlags; } + void SetFlags(uint_t uiFlags, uint_t uiMask = 0xffffffff) { m_uiFlags = (m_uiFlags & ~(uiFlags & uiMask)) | (uiFlags & uiMask); } + // operations void SetClipboard(CClipboardArray *pClipboard) { m_pClipboard=pClipboard; }; CString GetDestinationPath(CString strPath, unsigned char ucCopyNumber, int iFlags); @@ -268,6 +275,7 @@ COleDateTime m_timLastAccess; /** @cmember Last Access time */ COleDateTime m_timLastWrite; /** @cmember Last write time */ + uint_t m_uiFlags; // ptrs to elements providing data CClipboardArray *m_pClipboard; }; @@ -316,28 +324,41 @@ int AddFile(CString strFilePath, int iSrcIndex); // store/restore - void Store(CArchive& ar) + void Store(CArchive& ar, bool bOnlyFlags) { INT_PTR iSize = GetSize(); ar << iSize; for (INT_PTR i=0;i>iSize; SetSize(iSize, 5000); CFileInfo fi; fi.SetClipboard(m_pClipboard); + uint_t uiFlags = 0; for (INT_PTR i=0;i> uiFlags; + rInfo.SetFlags(uiFlags); + } + else + { + fi.Load(ar); + SetAt(i, fi); + } } } Index: src/ch/MainWnd.cpp =================================================================== diff -u -rc7c8665bac90c5701e577cd11acfad86538b8063 -r41fe62040d243a82461acabdad942307d7c9045f --- src/ch/MainWnd.cpp (.../MainWnd.cpp) (revision c7c8665bac90c5701e577cd11acfad86538b8063) +++ src/ch/MainWnd.cpp (.../MainWnd.cpp) (revision 41fe62040d243a82461acabdad942307d7c9045f) @@ -371,6 +371,8 @@ // current processed element fi=pTask->FilesGetAt(pTask->FilesGetSize()-i-1); + if(!(fi.GetFlags() & FIF_PROCESSED)) + continue; // delete data if (fi.IsDirectory()) @@ -458,6 +460,7 @@ pData->pTask->IncreaseProcessedSize(pData->pfiSrcFile->GetLength64()); pData->pTask->IncreaseProcessedTasksSize(pData->pfiSrcFile->GetLength64()); + pData->bProcessed = false; return; // don't continue if NC==0 or 1 } } @@ -525,6 +528,7 @@ case ID_IGNORE: pData->pTask->IncreaseProcessedSize(pData->pfiSrcFile->GetLength64()); pData->pTask->IncreaseProcessedTasksSize(pData->pfiSrcFile->GetLength64()); + pData->bProcessed = false; return; break; case ID_COPYRESTALL: @@ -604,6 +608,7 @@ case ID_IGNORE: pData->pTask->IncreaseProcessedSize(pData->pfiSrcFile->GetLength64()); pData->pTask->IncreaseProcessedTasksSize(pData->pfiSrcFile->GetLength64()); + pData->bProcessed = false; return; break; case IDCANCEL: @@ -675,6 +680,7 @@ case ID_IGNORE: pData->pTask->IncreaseProcessedSize(pData->pfiSrcFile->GetLength64()); pData->pTask->IncreaseProcessedTasksSize(pData->pfiSrcFile->GetLength64()); + pData->bProcessed = false; return; break; case ID_WAIT: @@ -819,6 +825,8 @@ // close files CloseHandle(hSrc); CloseHandle(hDst); + + pData->bProcessed = true; } catch(...) { @@ -846,12 +854,13 @@ // create a buffer of size pTask->m_nBufferSize CUSTOM_COPY_PARAMS ccp; + ccp.bProcessed = false; ccp.pTask=pTask; ccp.bOnlyCreate=(pTask->GetStatus(ST_SPECIAL_MASK) & ST_IGNORE_CONTENT) != 0; ccp.dbBuffer.Create(pTask->GetBufferSizes()); // helpers - CFileInfo fi; // for currently processed element + //CFileInfo fi; // for currently processed element DWORD dwLastError; // begin at index which wasn't processed previously @@ -874,7 +883,7 @@ { // update m_nCurrentIndex, getting current CFileInfo pTask->SetCurrentIndex(i); - fi=pTask->FilesGetAtCurrentIndex(); + CFileInfo& fi=pTask->FilesGetAtCurrentIndex(); // should we kill ? if (pTask->GetKillFlag()) @@ -898,6 +907,8 @@ pTask->m_log.logerr(GetResManager()->LoadString(IDS_OTFMOVEFILEERROR_STRING), dwLastError, fi.GetFullFilePath(), ccp.strDstFile); throw new CProcessingException(E_ERROR, pTask, IDS_CPEMOVEFILEERROR_STRING, dwLastError, fi.GetFullFilePath(), ccp.strDstFile); } + else + fi.SetFlags(FIF_PROCESSED, FIF_PROCESSED); } else { @@ -913,17 +924,20 @@ pTask->IncreaseProcessedSize(fi.GetLength64()); pTask->IncreaseProcessedTasksSize(fi.GetLength64()); + fi.SetFlags(FIF_PROCESSED, FIF_PROCESSED); } else { // start copying/moving file ccp.pfiSrcFile=&fi; + ccp.bProcessed = false; // kopiuj dane CustomCopyFile(&ccp); - + fi.SetFlags(ccp.bProcessed ? FIF_PROCESSED : 0, FIF_PROCESSED); + // if moving - delete file (only if config flag is set) - if (bMove && !GetConfig()->get_bool(PP_CMDELETEAFTERFINISHED) && j == iCopiesCount-1) + if (bMove && fi.GetFlags() & FIF_PROCESSED && !GetConfig()->get_bool(PP_CMDELETEAFTERFINISHED) && j == iCopiesCount-1) { if (!GetConfig()->get_bool(PP_CMPROTECTROFILES)) SetFileAttributes(fi.GetFullFilePath(), FILE_ATTRIBUTE_NORMAL); Index: src/ch/MainWnd.h =================================================================== diff -u -r4c272b19c74694c428c943011f279ec064fbd894 -r41fe62040d243a82461acabdad942307d7c9045f --- src/ch/MainWnd.h (.../MainWnd.h) (revision 4c272b19c74694c428c943011f279ec064fbd894) +++ src/ch/MainWnd.h (.../MainWnd.h) (revision 41fe62040d243a82461acabdad942307d7c9045f) @@ -36,6 +36,7 @@ CDataBuffer dbBuffer; // buffer handling bool bOnlyCreate; // flag from configuration - skips real copying - only create + bool bProcessed; // has the element been processed ? (false if skipped) } CUSTOM_COPY_PARAMS, *PCUSTOM_COPY_PARAMS; class CMainWnd : public CWnd