diff --git a/src/slic3r/GUI/GUI.cpp b/src/slic3r/GUI/GUI.cpp index 9d4e394213..841c5fcd21 100644 --- a/src/slic3r/GUI/GUI.cpp +++ b/src/slic3r/GUI/GUI.cpp @@ -547,7 +547,7 @@ void desktop_open_datadir_folder() #endif } -void desktop_open_any_folder( const std::string path ) +void desktop_open_any_folder( const std::string& path ) { // Execute command to open a file explorer, platform dependent. // FIXME: The const_casts aren't needed in wxWidgets 3.1, remove them when we upgrade. @@ -558,7 +558,14 @@ void desktop_open_any_folder( const std::string path ) #elif __APPLE__ openFolderForFile(from_u8(path)); #else - const char *argv[] = {"xdg-open", path.data(), nullptr}; + + // Orca#6449: Open containing dir instead of opening the file directly. + std::string new_path = path; + boost::filesystem::path p(new_path); + if (!fs::is_directory(p)) { + new_path = p.parent_path().string(); + } + const char* argv[] = {"xdg-open", new_path.data(), nullptr}; // Check if we're running in an AppImage container, if so, we need to remove AppImage's env vars, // because they may mess up the environment expected by the file manager. diff --git a/src/slic3r/GUI/GUI.hpp b/src/slic3r/GUI/GUI.hpp index 765406583f..db8cf06a61 100644 --- a/src/slic3r/GUI/GUI.hpp +++ b/src/slic3r/GUI/GUI.hpp @@ -83,7 +83,7 @@ extern void login(); // Ask the destop to open the datadir using the default file explorer. extern void desktop_open_datadir_folder(); // Ask the destop to open one folder -extern void desktop_open_any_folder(const std::string path); +extern void desktop_open_any_folder(const std::string& path); } // namespace GUI } // namespace Slic3r