mirror of
https://github.com/Dingo-Shenanigans/ReSkate.git
synced 2026-10-19 14:45:25 +02:00
Add cleanup of stale temporary files before download
Remove stale temporary files before downloading. Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
This commit is contained in:
1 parent
80242c0ec8
commit
573aab4bdb
1 file changed
+1
@@ -197,6 +197,7 @@ std::optional<std::string> get_text(std::wstring_view url, std::uint64_t max_byt
|
||||
const auto path = std::filesystem::path(length ? std::wstring(folder, length) : L".") /
|
||||
(L"reskate-get-" + std::to_wstring(GetCurrentProcessId()) + L"-" + std::to_wstring(++serial) + L".tmp");
|
||||
std::error_code error;
|
||||
std::filesystem::remove(path, error); // discard a stale file left by an earlier process
|
||||
const auto download = get(url, path, max_bytes, timeout_seconds, agent, watch);
|
||||
if (result) *result = download;
|
||||
std::optional<std::string> text;
|
||||
|
||||
Reference in new issue
Block a user