From 1e6e376a150722785884bf1fc6a3c50bb6d8cd84 Mon Sep 17 00:00:00 2001 From: "xin.zhang" Date: Sun, 12 Jan 2025 16:37:36 +0800 Subject: [PATCH] FIX: copy and override HMS files jira: [STUDIO-9570] Change-Id: Id2a1002a484e40c835d3dc54262ca0e9c84d20c6 --- src/slic3r/GUI/HMS.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/slic3r/GUI/HMS.cpp b/src/slic3r/GUI/HMS.cpp index b148a7a28..32f4fbc51 100644 --- a/src/slic3r/GUI/HMS.cpp +++ b/src/slic3r/GUI/HMS.cpp @@ -127,7 +127,7 @@ int HMSQuery::download_hms_related(const std::string& hms_type, const std::strin static void -_copy_dir(const fs::path& from_dir, const fs::path& to_dir) /* the copy will not override files*/ +_copy_dir(const fs::path& from_dir, const fs::path& to_dir) /* copy and override with local files*/ { try { @@ -147,8 +147,13 @@ _copy_dir(const fs::path& from_dir, const fs::path& to_dir) /* the copy will not const fs::path &relative_path = fs::relative(source_path, from_dir); const fs::path &dest_path = to_dir / relative_path; - if (fs::is_regular_file(source_path) && !fs::exists(dest_path)) + if (fs::is_regular_file(source_path)) { + if (fs::exists(dest_path)) + { + fs::remove(dest_path); + } + copy_file(source_path, dest_path); } else if (fs::is_directory(source_path))