From ad4af09d884e1727750571f7679e8679b8027a1c Mon Sep 17 00:00:00 2001 From: Mounir IDRASSI Date: Sun, 8 Feb 2015 13:45:15 +0100 Subject: Linux: When not under Gnome/KDE, use xdg-open to open the mounted volume if it is available. --- src/Main/UserInterface.cpp | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) (limited to 'src/Main') diff --git a/src/Main/UserInterface.cpp b/src/Main/UserInterface.cpp index 177a4e95..39c4274f 100644 --- a/src/Main/UserInterface.cpp +++ b/src/Main/UserInterface.cpp @@ -832,7 +832,7 @@ namespace VeraCrypt // MIME handler for directory seems to be unavailable through wxWidgets wxString desktop = GetTraits()->GetDesktopEnvironment(); - if (desktop == L"GNOME" || desktop.empty()) + if (desktop == L"GNOME") { args.push_back ("--no-default-window"); args.push_back ("--no-desktop"); @@ -865,6 +865,22 @@ namespace VeraCrypt catch (exception &e) { ShowError (e); } } } + else if (wxFileName::IsFileExecutable (wxT("/usr/bin/xdg-open"))) + { + // Fallback on the standard xdg-open command + // which is not always available by default + args.push_back (string (path)); + try + { + Process::Execute ("xdg-open", args, 2000); + } + catch (TimeOut&) { } + catch (exception &e) { ShowError (e); } + } + else + { + ShowWarning (wxT("Unable to find a file manager to open the mounted volume")); + } #endif } -- cgit v1.2.3