Start PrusaSlicer in gcode viewer mode when dragging and dropping a .gcode file on the application icon

This commit is contained in:
enricoturri1966 2020-10-02 11:40:21 +02:00
parent 0435993309
commit 11d8a2ad8e
3 changed files with 29 additions and 2 deletions

View file

@ -154,6 +154,17 @@ int CLI::run(int argc, char **argv)
// Read input file(s) if any.
#if ENABLE_GCODE_VIEWER
#if ENABLE_GCODE_DRAG_AND_DROP_GCODE_FILES
for (const std::string& file : m_input_files) {
std::string ext = boost::filesystem::path(file).extension().string();
if (boost::filesystem::path(file).extension().string() == ".gcode") {
if (boost::filesystem::exists(file)) {
start_as_gcodeviewer = true;
break;
}
}
}
#endif // ENABLE_GCODE_DRAG_AND_DROP_GCODE_FILES
if (!start_as_gcodeviewer) {
#endif // ENABLE_GCODE_VIEWER
for (const std::string& file : m_input_files) {