41 lines
1.5 KiB
Diff
41 lines
1.5 KiB
Diff
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(null,
|
|
+ spawn_args,
|
|
+ null,
|
|
+ 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
|
|
|