forked from msys2/MINGW-packages
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path0001-Open-directory-in-explorer.patch
More file actions
40 lines (37 loc) · 1.51 KB
/
Copy path0001-Open-directory-in-explorer.patch
File metadata and controls
40 lines (37 loc) · 1.51 KB
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
From f836c43a2d34edb1c3f9b58692d1e8c3949e4035 Mon Sep 17 00:00:00 2001
From: Doronin Stanislav <mugisbrows@gmail.com>
Date: Tue, 10 Aug 2021 20:45:50 +0300
Subject: [PATCH] Open directory in explorer
---
src/baobab-window.vala | 17 ++++++++++++++++-
1 file changed, 16 insertions(+), 1 deletion(-)
diff --git a/src/baobab-window.vala b/src/baobab-window.vala
index 26c5ff5..4ac55b1 100644
--- a/src/baobab-window.vala
+++ b/src/baobab-window.vala
@@ -370,7 +370,22 @@ namespace Baobab {
public void open_item (Gtk.TreeIter iter) {
var file = active_location.scanner.get_file (iter);
try {
- AppInfo.launch_default_for_uri (file.get_uri (), null);
+ string path = file.get_path();
+ bool is_dir = FileUtils.test(path, FileTest.IS_DIR);
+ string[] spawn_args;
+ if (is_dir) {
+ spawn_args = {"explorer", path};
+ } else {
+ spawn_args = {"explorer", "/select,", path};
+ }
+ string[] spawn_env = Environ.get();
+ Pid child_pid;
+ Process.spawn_async(".",
+ spawn_args,
+ spawn_env,
+ SpawnFlags.SEARCH_PATH | SpawnFlags.DO_NOT_REAP_CHILD,
+ null,
+ out child_pid);
} catch (Error e) {
message (_("Failed to open file"), e.message, Gtk.MessageType.ERROR);
}
--
2.25.1.windows.1