/* */ #include "CopyDiskAdaptor.h" #include "FileEntry.h" #include "Logger.h" #include "Util.h" #include "message.h" namespace aria2 { void CopyDiskAdaptor::onDownloadComplete() { closeFile(); fixFilename(); openFile(); } void CopyDiskAdaptor::fixFilename() { off_t offset = 0; for(FileEntries::iterator itr = fileEntries.begin(); itr != fileEntries.end(); itr++) { if(!(*itr)->isExtracted() && (*itr)->isRequested()) { std::string topDirPath = storeDir+"/"+topDir; (*itr)->setupDir(topDirPath); std::string destFilePath = topDirPath+"/"+(*itr)->getPath(); logger->info(MSG_WRITING_FILE, destFilePath.c_str()); Util::rangedFileCopy(destFilePath, getFilePath(), offset, (*itr)->getLength()); (*itr)->setExtracted(true); } offset += (*itr)->getLength(); } } std::string CopyDiskAdaptor::getFilePath() { return storeDir+"/"+tempFilename; } } // namespace aria2