mirror of
https://github.com/Sude-/lgogdownloader.git
synced 2024-11-20 11:49:17 +01:00
Delete file on failed download
File is deleted if the download wasn't a resume attempt or the result is zero length file
This commit is contained in:
parent
21699adc45
commit
4f5300be75
@ -3034,6 +3034,16 @@ void Downloader::processDownloadQueue(Config conf, const unsigned int& tid)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
msgQueue.push(msg_prefix + "Finished download (" + static_cast<std::string>(curl_easy_strerror(result)) + "): " + filepath.filename().string());
|
msgQueue.push(msg_prefix + "Finished download (" + static_cast<std::string>(curl_easy_strerror(result)) + "): " + filepath.filename().string());
|
||||||
|
|
||||||
|
// Delete the file if download failed and was not a resume attempt or the result is zero length file
|
||||||
|
if (boost::filesystem::exists(filepath) && boost::filesystem::is_regular_file(filepath))
|
||||||
|
{
|
||||||
|
if ((result != CURLE_PARTIAL_FILE && !bResume && result != CURLE_OPERATION_TIMEDOUT) || boost::filesystem::file_size(filepath) == 0)
|
||||||
|
{
|
||||||
|
if (!boost::filesystem::remove(filepath))
|
||||||
|
msgQueue.push(msg_prefix + "Failed to delete " + filepath.filename().string());
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Automatic xml creation
|
// Automatic xml creation
|
||||||
|
Loading…
Reference in New Issue
Block a user