FIX: CLI: fix the stl name not correct issue when using export-stl

jira: no-jira
Change-Id: I5cd83c9fb787416d5045470025fa96696d8bfab9
This commit is contained in:
lane.wei 2025-01-25 10:58:52 +08:00 committed by Lane.Wei
parent e1819e65f9
commit 212f757c51
1 changed files with 3 additions and 3 deletions

View File

@ -1337,7 +1337,7 @@ int CLI::run(int argc, char **argv)
//"--filament-map", //"--filament-map",
//"1,2,1,2", //"1,2,1,2",
"--slice=0", "--slice=0",
"cube_a1.3mf" "stl_test.3mf"
}; };
if (! this->setup(debug_argc, debug_argv))*/ if (! this->setup(debug_argc, debug_argv))*/
if (!this->setup(argc, argv)) if (!this->setup(argc, argv))
@ -6848,8 +6848,8 @@ std::string CLI::output_filepath(const ModelObject &object, unsigned int index,
// use --outputdir when available // use --outputdir when available
file_name = object.name.empty()?object.input_file:object.name; file_name = object.name.empty()?object.input_file:object.name;
file_name = "obj_"+std::to_string(index)+"_"+file_name; file_name = "obj_"+std::to_string(index)+"_"+file_name;
size_t pos = file_name.find_last_of(ext), ext_pos = file_name.size() - 1; size_t pos = file_name.rfind(ext), ext_pos = file_name.size() - ext.size();
if (pos != ext_pos) if ((pos == std::string::npos) || (pos != ext_pos))
file_name += ext; file_name += ext;
BOOST_LOG_TRIVIAL(trace) << __FUNCTION__ << ": dir = "<< path_dir<<", file_name="<<file_name<< ", pos = "<<pos<<", ext_pos="<<ext_pos; BOOST_LOG_TRIVIAL(trace) << __FUNCTION__ << ": dir = "<< path_dir<<", file_name="<<file_name<< ", pos = "<<pos<<", ext_pos="<<ext_pos;