mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-13 09:47:58 -06:00
Fix "Open Containing Folder" on Linux (#6469)
Fix "Open Containing Folder" on Linux (SoftFever/OrcaSlicer#6449)
This commit is contained in:
parent
4dd7d79d76
commit
12c4ff0d93
2 changed files with 10 additions and 3 deletions
|
@ -547,7 +547,7 @@ void desktop_open_datadir_folder()
|
||||||
#endif
|
#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.
|
// 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.
|
// 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__
|
#elif __APPLE__
|
||||||
openFolderForFile(from_u8(path));
|
openFolderForFile(from_u8(path));
|
||||||
#else
|
#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,
|
// 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.
|
// because they may mess up the environment expected by the file manager.
|
||||||
|
|
|
@ -83,7 +83,7 @@ extern void login();
|
||||||
// Ask the destop to open the datadir using the default file explorer.
|
// Ask the destop to open the datadir using the default file explorer.
|
||||||
extern void desktop_open_datadir_folder();
|
extern void desktop_open_datadir_folder();
|
||||||
// Ask the destop to open one 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 GUI
|
||||||
} // namespace Slic3r
|
} // namespace Slic3r
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue