From 18b9bffd02f17530b870123041caf45bad014719 Mon Sep 17 00:00:00 2001 From: "lane.wei" Date: Thu, 26 Jun 2025 20:21:05 +0800 Subject: [PATCH] ENH: 3mf: fix save fullpath issue jira: no-jira Change-Id: I3077cceae2dfadc2882b4eb1de2234c5c445f342 (cherry picked from commit 5776d8e3fc4f8578b9ed397bd0afe0f9668cd634) --- src/libslic3r/Format/bbs_3mf.cpp | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/libslic3r/Format/bbs_3mf.cpp b/src/libslic3r/Format/bbs_3mf.cpp index f5b4c9b6ed..721e330f9b 100644 --- a/src/libslic3r/Format/bbs_3mf.cpp +++ b/src/libslic3r/Format/bbs_3mf.cpp @@ -5592,7 +5592,7 @@ void PlateData::parse_filament_info(GCodeProcessorResult *result) typedef std::vector BuildItemsList; typedef std::map ObjectToObjectDataMap; - bool m_fullpath_sources{ true }; + bool m_fullpath_sources{ false }; bool m_zip64 { true }; bool m_production_ext { false }; // save with Production Extention bool m_skip_static{ false }; // not save mesh and other big static contents @@ -7592,7 +7592,16 @@ void PlateData::parse_filament_info(GCodeProcessorResult *result) // stores volume's source data { - std::string input_file = xml_escape(m_fullpath_sources ? volume->source.input_file : boost::filesystem::path(volume->source.input_file).filename().string()); + #if defined(__linux__) || defined(__LINUX__) || defined(__APPLE__) + std::string translated_input = volume->source.input_file; + std::replace(translated_input.begin(), translated_input.end(), '\\', '/'); + + boost::filesystem::path file_path(translated_input); + #else + boost::filesystem::path file_path(volume->source.input_file); + #endif + + std::string input_file = xml_escape(m_fullpath_sources ? volume->source.input_file : file_path.filename().string()); //std::string prefix = std::string(" <") + METADATA_TAG + " " + KEY_ATTR + "=\""; std::string prefix = std::string(" <") + METADATA_TAG + " " + KEY_ATTR + "=\""; if (! volume->source.input_file.empty()) {