MCPcopy Create free account
hub / github.com/amule-project/amule / CreatePartFile

Method CreatePartFile

src/PartFile.cpp:341–381  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

339}
340
341void CPartFile::CreatePartFile(bool isImporting)
342{
343 // use lowest free partfilenumber for free file (InterCeptor)
344 int i = 0;
345 do {
346 ++i;
347 m_partmetfilename = CPath(CFormat("%03i.part.met") % i);
348 m_fullname = thePrefs::GetTempDir().JoinPaths(m_partmetfilename);
349 } while (m_fullname.FileExists());
350
351 m_CorruptionBlackBox->SetPartFileInfo(GetFileName().GetPrintable(), m_partmetfilename.RemoveAllExt().GetPrintable());
352
353 m_gaplist.Init(GetFileSize(), true); // Init empty
354
355 m_PartPath = m_fullname.RemoveExt();
356 bool fileCreated;
357 if (thePrefs::GetAllocFullFile() || !thePrefs::CreateFilesSparse()) {
358 fileCreated = m_hpartfile.Create(m_PartPath, true);
359 m_hpartfile.Close();
360 } else {
361 fileCreated = PlatformSpecific::CreateSparseFile(m_PartPath, GetFileSize());
362 }
363 if (!fileCreated) {
364 AddLogLineN(_("ERROR: Failed to create partfile"));
365 SetStatus(PS_ERROR);
366 }
367
368 SetFilePath(thePrefs::GetTempDir());
369
370 if (!isImporting && thePrefs::GetAllocFullFile()) {
371 SetStatus(PS_ALLOCATING);
372 CThreadScheduler::AddTask(new CAllocateFileTask(this, thePrefs::AddNewFilesPaused()));
373 } else {
374 AllocationFinished();
375 }
376
377 m_hashsetneeded = (GetED2KPartHashCount() > 0);
378
379 SavePartFile(true);
380 SetActive(theApp->IsConnected());
381}
382
383
384uint8 CPartFile::LoadPartFile(const CPath& in_directory, const CPath& filename, bool from_backup, bool getsizeonly)

Callers 1

performConvertToeMuleMethod · 0.80

Calls 12

CFormatClass · 0.85
JoinPathsMethod · 0.80
FileExistsMethod · 0.80
SetPartFileInfoMethod · 0.80
GetPrintableMethod · 0.80
RemoveAllExtMethod · 0.80
RemoveExtMethod · 0.80
CPathClass · 0.70
InitMethod · 0.45
CreateMethod · 0.45
CloseMethod · 0.45
IsConnectedMethod · 0.45

Tested by

no test coverage detected