From 6bca20f38269ed1c7ef47033af0ae656bf2f4707 Mon Sep 17 00:00:00 2001 From: SimplestStudio Date: Thu, 4 May 2023 10:55:14 +0300 Subject: [PATCH] [win] add deleting undownloaded files --- win-linux/extras/update-daemon/src/classes/cdownloader.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/win-linux/extras/update-daemon/src/classes/cdownloader.cpp b/win-linux/extras/update-daemon/src/classes/cdownloader.cpp index d6c42894a..f3440d02c 100644 --- a/win-linux/extras/update-daemon/src/classes/cdownloader.cpp +++ b/win-linux/extras/update-daemon/src/classes/cdownloader.cpp @@ -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);