Ejemplo n.º 1
0
bool Par1Repairer::RemoveParFiles(void) {
	if (noiselevel > CommandLine::nlSilent
			&& parlist.size() > 0) {
			cout << endl << "Purge par files." << endl;
	}

	for (list<string>::const_iterator s=parlist.begin(); s!=parlist.end(); ++s) {
		DiskFile *diskfile = new DiskFile;

		if (diskfile->Open(*s)) {
			if (noiselevel > CommandLine::nlSilent) {
				string name;
				string path;
				DiskFile::SplitFilename((*s), path, name);
				cout << "Remove \"" << name << "\"." << endl;
			}

			if (diskfile->IsOpen())
				diskfile->Close();
			diskfile->Delete();
		}

		delete diskfile;
	}

	return true;
}
Ejemplo n.º 2
0
// Delete all of the partly reconstructed files
bool Par1Repairer::DeleteIncompleteTargetFiles(void) {
	list<Par1RepairerSourceFile*>::iterator sf = verifylist.begin();

	// Iterate through each file in the verification list
	while (sf != verifylist.end()) {
		Par1RepairerSourceFile *sourcefile = *sf;
		if (sourcefile->GetTargetExists()) {
			DiskFile *targetfile = sourcefile->GetTargetFile();

			// Close and delete the file
			if (targetfile->IsOpen())
				targetfile->Close();
			targetfile->Delete();

			// Forget the file
			diskfilemap.Remove(targetfile);

			delete targetfile;

			// There is no target file
			sourcefile->SetTargetExists(false);
			sourcefile->SetTargetFile(0);
		}

		++sf;
	}

	return true;
}