FIX:add slash_to_back_slash for saving file path

Jira: STUDIO-5287
Change-Id: I9f3c176cd0831c793958f08601c63efac98176a4
This commit is contained in:
zhou.xu 2023-11-22 15:21:36 +08:00 committed by Lane.Wei
parent 636c7dd048
commit c53a458942
4 changed files with 12 additions and 5 deletions

View File

@ -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();
}

View File

@ -1,5 +1,4 @@
#include "CreatePresetsDialog.hpp"
#include <regex>
#include <vector>
#include <set>
#include <unordered_map>
@ -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){

View File

@ -1,5 +1,6 @@
#include "FileHelp.hpp"
#include <boost/filesystem.hpp>
#include <regex>
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

View File

@ -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_