diff --git a/src/slic3r/GUI/BedShapeDialog.cpp b/src/slic3r/GUI/BedShapeDialog.cpp index abd0cf8db..2ed563058 100644 --- a/src/slic3r/GUI/BedShapeDialog.cpp +++ b/src/slic3r/GUI/BedShapeDialog.cpp @@ -592,6 +592,7 @@ void BedShapePanel::load_texture() wxBusyCursor wait; m_custom_texture = file_name; + Utils::slash_to_back_slash(m_custom_texture); update_shape(); } @@ -622,6 +623,7 @@ void BedShapePanel::load_model() wxBusyCursor wait; m_custom_model = file_name; + Utils::slash_to_back_slash(m_custom_model); update_shape(); } diff --git a/src/slic3r/GUI/CreatePresetsDialog.cpp b/src/slic3r/GUI/CreatePresetsDialog.cpp index 8d5fdcb67..991aaa301 100644 --- a/src/slic3r/GUI/CreatePresetsDialog.cpp +++ b/src/slic3r/GUI/CreatePresetsDialog.cpp @@ -1,5 +1,4 @@ #include "CreatePresetsDialog.hpp" -#include #include #include #include @@ -2987,9 +2986,9 @@ bool CreatePrinterPresetDialog::save_printable_area_config(Preset *preset) double max_print_height = 0; m_print_height_input->GetTextCtrl()->GetValue().ToDouble(&max_print_height); config.set("printable_height", max_print_height); - std::regex regex("\\\\"); - m_custom_model = std::regex_replace(m_custom_model, regex, "/"); - m_custom_texture = std::regex_replace(m_custom_texture, regex, "/"); + + Utils::slash_to_back_slash(m_custom_texture); + Utils::slash_to_back_slash(m_custom_model); config.set("bed_custom_model", m_custom_model); config.set("bed_custom_texture", m_custom_texture); } else if(m_create_type.create_nozzle){ diff --git a/src/slic3r/Utils/FileHelp.cpp b/src/slic3r/Utils/FileHelp.cpp index 5e8d4b010..c272112c7 100644 --- a/src/slic3r/Utils/FileHelp.cpp +++ b/src/slic3r/Utils/FileHelp.cpp @@ -1,5 +1,6 @@ #include "FileHelp.hpp" #include +#include namespace Slic3r { namespace Utils { @@ -17,4 +18,9 @@ bool is_file_too_large(std::string file_path, bool &try_ok) return false; } +void slash_to_back_slash(std::string &file_path) { + std::regex regex("\\\\"); + file_path = std::regex_replace(file_path, regex, "/"); +} + }} // namespace Slic3r::Utils \ No newline at end of file diff --git a/src/slic3r/Utils/FileHelp.hpp b/src/slic3r/Utils/FileHelp.hpp index 4fa327852..6642354f2 100644 --- a/src/slic3r/Utils/FileHelp.hpp +++ b/src/slic3r/Utils/FileHelp.hpp @@ -7,7 +7,7 @@ namespace Slic3r { namespace Utils { bool is_file_too_large(std::string file_path, bool &try_ok); - +void slash_to_back_slash(std::string& file_path);// "//" to "\" } } #endif // file_help_hpp_