Index: src/libchcore/TSubTaskBase.cpp =================================================================== diff -u -N -rf866db90e4b058a4f2e13cc6cf076d1e0bf2d956 -r7ba9f25ab2c2a42bac9f5455ecb98aaf6e29f02d --- src/libchcore/TSubTaskBase.cpp (.../TSubTaskBase.cpp) (revision f866db90e4b058a4f2e13cc6cf076d1e0bf2d956) +++ src/libchcore/TSubTaskBase.cpp (.../TSubTaskBase.cpp) (revision 7ba9f25ab2c2a42bac9f5455ecb98aaf6e29f02d) @@ -43,83 +43,4 @@ TSubTaskBase::~TSubTaskBase() { } - - TSmartPath TSubTaskBase::CalculateDestinationPath(const TFileInfoPtr& spFileInfo, TSmartPath pathDst, int iFlags) - { - IFilesystemPtr spFilesystem = GetContext().GetLocalFilesystem(); - - if (!spFileInfo) - throw TCoreException(eErr_InvalidArgument, L"spFileInfo", LOCATION); - - // iFlags: bit 0-ignore folders; bit 1-force creating directories - if (iFlags & 0x02) - { - // force create directories - TSmartPath pathCombined = pathDst + spFileInfo->GetFullFilePath().GetFileDir(); - - // force create directory - spFilesystem->CreateDirectory(pathCombined, true); - - return pathCombined + spFileInfo->GetFullFilePath().GetFileName(); - } - else - { - TBasePathDataPtr spPathData = spFileInfo->GetBasePathData(); - - if (!(iFlags & 0x01) && spPathData) - { - // generate new dest name - if (!spPathData->IsDestinationPathSet()) - { - // generate something - if dest folder == src folder - search for copy - if (pathDst == spFileInfo->GetFullFilePath().GetFileRoot()) - { - TSmartPath pathSubst = FindFreeSubstituteName(spFileInfo->GetFullFilePath(), pathDst); - spPathData->SetDestinationPath(pathSubst); - } - else - { - TSmartPath pathFilename = spFileInfo->GetFullFilePath().GetFileName(); - pathFilename.StripPath(L":"); - spPathData->SetDestinationPath(pathFilename); - } - } - - return pathDst + spPathData->GetDestinationPath() + spFileInfo->GetFilePath(); - } - else - return pathDst + spFileInfo->GetFilePath(); - } - } - - // finds another name for a copy of src file(folder) in dest location - TSmartPath TSubTaskBase::FindFreeSubstituteName(TSmartPath pathSrcPath, TSmartPath pathDstPath) const - { - const TConfig& rConfig = GetContext().GetConfig(); - IFilesystemPtr spFilesystem = GetContext().GetLocalFilesystem(); - - // get the name from src path - pathSrcPath.StripSeparatorAtEnd(); - - TSmartPath pathFilename = pathSrcPath.GetFileName(); - pathFilename.StripPath(L":"); - - // set the dest path - TString strCheckPath = GetTaskPropValue(rConfig); - strCheckPath.Replace(_T("%name"), pathFilename.ToString()); - TSmartPath pathCheckPath(PathFromWString(strCheckPath)); - - // when adding to strDstPath check if the path already exists - if so - try again - int iCounter = 1; - TString strFmt = GetTaskPropValue(rConfig); - while (spFilesystem->PathExist(pathDstPath + pathCheckPath)) - { - strCheckPath = strFmt; - strCheckPath.Replace(_T("%name"), pathFilename.ToString()); - strCheckPath.Replace(_T("%count"), boost::lexical_cast(++iCounter).c_str()); - pathCheckPath.FromString(strCheckPath); - } - - return pathCheckPath; - } }