69{
70 boost::nowide::ifstream infile(path);
71 if (!infile.good()) {
72 throw Slic3r::RuntimeError(
_u8L(
"Load step file failed.\nCannot open file for reading.\n"));
73 return false;
74 }
75
77 std::string temp_step_path = temp_path.string() + "/temp.step";
78 boost::nowide::remove(temp_step_path.c_str());
79 boost::nowide::ofstream temp_file(temp_step_path, std::ios::app);
80 std::string temp_line;
81 while (std::getline(infile, temp_line)) {
83
85
86 }
87
88 else if (
isGBK(temp_line)) {
90 }
91
92
93 else {
95 }
96 }
98
99
100 temp_file <<
decode_path(temp_line.c_str()) << std::endl;
101 else
102 temp_file << temp_line.c_str() << std::endl;
103 }
104 temp_file.close();
105 infile.close();
107 output_path = temp_step_path;
108 } else {
109 boost::nowide::remove(temp_step_path.c_str());
110 output_path = std::string(path);
111 }
112
113 return true;
114}
@ OTHER
Definition STEP.hpp:68
@ GBK
Definition STEP.hpp:67
@ UTF8
Definition STEP.hpp:66
EncodedType m_encode_type
Definition STEP.hpp:79
static bool isGBK(const std::string str)
Definition STEP.cpp:162
std::string decode_path(const char *src)
Definition utils.cpp:1401
const std::string & temporary_dir()
Definition utils.cpp:308