summarylogtreecommitdiffstats
path: root/xdg-open.patch
blob: 910f86a576f74782942fdcd499e7acfe98f7fb2e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
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