From 7c2ec323303bdd09f74b2f32c2e0fb80a40cba3e Mon Sep 17 00:00:00 2001 From: alves Date: Mon, 9 Feb 2026 19:09:45 +0800 Subject: [PATCH] fix resource remove old file before download. --- src/slic3r/Utils/PresetUpdater.cpp | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/src/slic3r/Utils/PresetUpdater.cpp b/src/slic3r/Utils/PresetUpdater.cpp index 935254683b..e8d7fb5f0a 100644 --- a/src/slic3r/Utils/PresetUpdater.cpp +++ b/src/slic3r/Utils/PresetUpdater.cpp @@ -808,8 +808,19 @@ void PresetUpdater::priv::sync_update_flutter_resource(bool isAuto_check) return; } - if (currentPresetVersion < remoteVersion) + if (currentPresetVersion < remoteVersion) { + + if (fs::exists(fileName)) + fs::remove(fileName); + + fs::path tmpPath = fileName; + auto dirPath = tmpPath.parent_path() / "profiles/flutter_web"; + + if (fs::exists(dirPath)) + fs::remove_all(dirPath); + download_file(fileUrl, fileName, "../ota/profiles/"); + } else { if (!isAuto_check) { wxCommandEvent* evt = new wxCommandEvent(EVT_NO_WEB_RESOURCE_UPDATE); @@ -917,8 +928,18 @@ void PresetUpdater::priv::sync_config(bool isAuto_check) return; } - if (currentPresetVersion < remoteVersion) + if (currentPresetVersion < remoteVersion) { + if (fs::exists(fileName)) + fs::remove(fileName); + + fs::path tmpPath = fileName; + auto dirPath = tmpPath.parent_path() / "profiles/profiles"; + + if (fs::exists(dirPath)) + fs::remove_all(dirPath); + download_file(fileUrl, fileName, "../ota/profiles/profiles/"); + } else { if (!isAuto_check) { wxCommandEvent* evt = new wxCommandEvent(EVT_NO_PRESET_UPDATE);