[win] add deleting undownloaded files

This commit is contained in:
SimplestStudio
2023-05-04 10:55:14 +03:00
parent 1a5f3abb36
commit 6bca20f382

View File

@ -149,8 +149,11 @@ int downloadToFile(const wstring &url, const wstring &filePath, std::atomic_bool
} while (dwSize > 0);
cleanup :
if (hFile != INVALID_HANDLE_VALUE)
if (hFile != INVALID_HANDLE_VALUE) {
CloseHandle(hFile);
if (result == DNL_ABORT)
DeleteFile(filePath.c_str());
}
WinHttpCloseHandle(hRequest);
WinHttpCloseHandle(hConnect);
WinHttpCloseHandle(hSession);