Index: src/ch/TSubTaskCopyMove.cpp =================================================================== diff -u -N -r633a533cb6e741d44fe28aa56339e1d2709b1b27 -r4c09a2d7ab35a30114ff2b7c4db12bc413bf538c --- src/ch/TSubTaskCopyMove.cpp (.../TSubTaskCopyMove.cpp) (revision 633a533cb6e741d44fe28aa56339e1d2709b1b27) +++ src/ch/TSubTaskCopyMove.cpp (.../TSubTaskCopyMove.cpp) (revision 4c09a2d7ab35a30114ff2b7c4db12bc413bf538c) @@ -28,7 +28,6 @@ #include "task.h" #include "TLocalFilesystem.h" #include "FeedbackHandler.h" -#include "Device IO.h" // assume max sectors of 4kB (for rounding) #define MAXSECTORSIZE 4096 @@ -275,51 +274,31 @@ int TSubTaskCopyMove::GetBufferIndex(const CFileInfoPtr& spFileInfo) { - TBasePathDataContainer& rSrcPathsInfo = GetContext().GetBasePathDataContainer(); - chcore::TTaskDefinition& rTaskDefinition = GetContext().GetTaskDefinition(); - if(!spFileInfo) THROW(_T("Invalid pointer"), 0, 0, 0); - if(spFileInfo->GetSrcIndex() == std::numeric_limits::max()) - THROW(_T("Received non-relative (standalone) path info"), 0, 0, 0); - // check if this information has already been stored - size_t stBaseIndex = spFileInfo->GetSrcIndex(); - if(stBaseIndex >= rSrcPathsInfo.GetCount()) - THROW(_T("Index out of bounds"), 0, 0, 0); + chcore::TSmartPath pathSource = spFileInfo->GetFullFilePath(); + chcore::TSmartPath pathDestination = GetContext().GetTaskDefinition().GetDestinationPath(); - TBasePathDataPtr spPathData = rSrcPathsInfo.GetAt(stBaseIndex); - if(spPathData->IsBufferIndexSet()) - return spPathData->GetBufferIndex(); + TLocalFilesystem::EPathsRelation eRelation = GetContext().GetLocalFilesystem().GetPathsRelation(pathSource, pathDestination); + switch(eRelation) + { + case TLocalFilesystem::eRelation_Network: + return BI_LAN; - // buffer index wasn't cached previously - read it now - int iDriveNumber = 0; - UINT uiDriveType = 0; - int iDstDriveNumber = 0; - UINT uiDstDriveType = 0; - TLocalFilesystem::GetDriveData(rTaskDefinition.GetSourcePathAt(stBaseIndex), &iDriveNumber, &uiDriveType); - TLocalFilesystem::GetDriveData(rTaskDefinition.GetDestinationPath(), &iDstDriveNumber, &uiDstDriveType); + case TLocalFilesystem::eRelation_CDRom: + return BI_CD; - // what kind of buffer - int iBufferIndex = BI_DEFAULT; - if(uiDriveType == DRIVE_REMOTE || uiDstDriveType == DRIVE_REMOTE) - iBufferIndex = BI_LAN; - else if(uiDriveType == DRIVE_CDROM || uiDstDriveType == DRIVE_CDROM) - iBufferIndex = BI_CD; - else if(uiDriveType == DRIVE_FIXED && uiDstDriveType == DRIVE_FIXED) - { - // two hdd's - is this the same physical disk ? - if(iDriveNumber == iDstDriveNumber || IsSamePhysicalDisk(iDriveNumber, iDstDriveNumber)) - iBufferIndex = BI_ONEDISK; - else - iBufferIndex = BI_TWODISKS; - } - else - iBufferIndex = BI_DEFAULT; + case TLocalFilesystem::eRelation_TwoPhysicalDisks: + return BI_TWODISKS; - spPathData->SetBufferIndex(iBufferIndex); + case TLocalFilesystem::eRelation_SinglePhysicalDisk: + return BI_ONEDISK; - return iBufferIndex; + //case eRelation_Other: + default: + return BI_DEFAULT; + } } TSubTaskBase::ESubOperationResult TSubTaskCopyMove::CustomCopyFileFB(CUSTOM_COPY_PARAMS* pData)