summarylogtreecommitdiffstats
path: root/xdg-open.patch
diff options
context:
space:
mode:
Diffstat (limited to 'xdg-open.patch')
-rw-r--r--xdg-open.patch81
1 files changed, 81 insertions, 0 deletions
diff --git a/xdg-open.patch b/xdg-open.patch
new file mode 100644
index 000000000000..910f86a576f7
--- /dev/null
+++ b/xdg-open.patch
@@ -0,0 +1,81 @@
+From ad4af09d884e1727750571f7679e8679b8027a1c Mon Sep 17 00:00:00 2001
+From: Mounir IDRASSI <mounir.idrassi@idrix.fr>
+Date: Sun, 8 Feb 2015 13:45:15 +0100
+Subject: [PATCH] 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(-)
+
+diff --git a/src/Main/UserInterface.cpp b/src/Main/UserInterface.cpp
+index 177a4e9..39c4274 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
+ }
+
+From 3a9db8d98c1301726bdf26af9698e7cc61a46f71 Mon Sep 17 00:00:00 2001
+From: Mounir IDRASSI <mounir.idrassi@idrix.fr>
+Date: Wed, 2 Dec 2015 11:10:30 +0100
+Subject: [PATCH] Linux: fix Nautilus not detected as file manager on some
+ Gnome based destributions.
+
+---
+ src/Main/UserInterface.cpp | 6 ++++--
+ 1 file changed, 4 insertions(+), 2 deletions(-)
+
+diff --git a/src/Main/UserInterface.cpp b/src/Main/UserInterface.cpp
+index 73c9914..2be5bc7 100644
+--- a/src/Main/UserInterface.cpp
++++ b/src/Main/UserInterface.cpp
+@@ -834,8 +834,10 @@ namespace VeraCrypt
+ #else
+ // MIME handler for directory seems to be unavailable through wxWidgets
+ wxString desktop = GetTraits()->GetDesktopEnvironment();
++ bool xdgOpenPresent = wxFileName::IsFileExecutable (wxT("/usr/bin/xdg-open"));
++ bool nautilusPresent = wxFileName::IsFileExecutable (wxT("/usr/bin/nautilus"));
+
+- if (desktop == L"GNOME")
++ if (desktop == L"GNOME" || (desktop.empty() && !xdgOpenPresent && nautilusPresent))
+ {
+ args.push_back ("--no-default-window");
+ args.push_back ("--no-desktop");
+@@ -868,7 +870,7 @@ namespace VeraCrypt
+ catch (exception &e) { ShowError (e); }
+ }
+ }
+- else if (wxFileName::IsFileExecutable (wxT("/usr/bin/xdg-open")))
++ else if (xdgOpenPresent)
+ {
+ // Fallback on the standard xdg-open command
+ // which is not always available by default