From fdce8e2f1b5f0dfe725b4acd9c7e5d490555e6c0 Mon Sep 17 00:00:00 2001 From: Aidan M Date: Wed, 3 Jul 2024 20:24:50 +0100 Subject: [PATCH 1/4] Use default Windows file handler --- Wabbajack.App.Wpf/Util/UIUtils.cs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Wabbajack.App.Wpf/Util/UIUtils.cs b/Wabbajack.App.Wpf/Util/UIUtils.cs index 152de857..63cfb9e7 100644 --- a/Wabbajack.App.Wpf/Util/UIUtils.cs +++ b/Wabbajack.App.Wpf/Util/UIUtils.cs @@ -56,7 +56,6 @@ namespace Wabbajack } } - public static void OpenWebsite(Uri url) { Process.Start(new ProcessStartInfo("cmd.exe", $"/c start {url}") @@ -64,16 +63,17 @@ namespace Wabbajack CreateNoWindow = true, }); } - + public static void OpenFolder(AbsolutePath path) { - Process.Start(new ProcessStartInfo(KnownFolders.Windows.Combine("explorer.exe").ToString(), path.ToString()) + Process.Start(new ProcessStartInfo() { - CreateNoWindow = true, + FileName = path.ToString(), + UseShellExecute = true, + Verb = "open" }); } - public static AbsolutePath OpenFileDialog(string filter, string initialDirectory = null) { OpenFileDialog ofd = new OpenFileDialog(); From 22fcd4b5c8f1cd996e8be884a11f4708c8985145 Mon Sep 17 00:00:00 2001 From: Aidan M Date: Wed, 3 Jul 2024 20:53:35 +0100 Subject: [PATCH 2/4] Add check to ensure it is definitely a folder being opened, and modify other hard-coded `explorer.exe` reference --- Wabbajack.App.Wpf/Util/UIUtils.cs | 9 ++++++++- .../View Models/Installers/MO2InstallerVM.cs | 2 +- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/Wabbajack.App.Wpf/Util/UIUtils.cs b/Wabbajack.App.Wpf/Util/UIUtils.cs index 63cfb9e7..7368d2bc 100644 --- a/Wabbajack.App.Wpf/Util/UIUtils.cs +++ b/Wabbajack.App.Wpf/Util/UIUtils.cs @@ -19,6 +19,7 @@ using Wabbajack.Extensions; using Wabbajack.Models; using Wabbajack.Paths; using Wabbajack.Paths.IO; +using System.Linq; namespace Wabbajack { @@ -66,9 +67,15 @@ namespace Wabbajack public static void OpenFolder(AbsolutePath path) { + String folderPath = path.ToString(); + if (!folderPath.EndsWith(Path.DirectorySeparatorChar.ToString())) + { + folderPath += Path.DirectorySeparatorChar.ToString(); + } + Process.Start(new ProcessStartInfo() { - FileName = path.ToString(), + FileName = folderPath, UseShellExecute = true, Verb = "open" }); diff --git a/Wabbajack.App.Wpf/View Models/Installers/MO2InstallerVM.cs b/Wabbajack.App.Wpf/View Models/Installers/MO2InstallerVM.cs index f9bc25a4..623381e0 100644 --- a/Wabbajack.App.Wpf/View Models/Installers/MO2InstallerVM.cs +++ b/Wabbajack.App.Wpf/View Models/Installers/MO2InstallerVM.cs @@ -77,7 +77,7 @@ namespace Wabbajack public void AfterInstallNavigation() { - Process.Start("explorer.exe", Location.TargetPath.ToString()); + UIUtils.OpenFolder(Location.TargetPath); } public async Task Install() From 2d72370c32bc0762cbb0c0f849e703ecd19ac22d Mon Sep 17 00:00:00 2001 From: Aidan M Date: Wed, 3 Jul 2024 20:55:24 +0100 Subject: [PATCH 3/4] Remove accidentally added import --- Wabbajack.App.Wpf/Util/UIUtils.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/Wabbajack.App.Wpf/Util/UIUtils.cs b/Wabbajack.App.Wpf/Util/UIUtils.cs index 7368d2bc..53e45eff 100644 --- a/Wabbajack.App.Wpf/Util/UIUtils.cs +++ b/Wabbajack.App.Wpf/Util/UIUtils.cs @@ -19,7 +19,6 @@ using Wabbajack.Extensions; using Wabbajack.Models; using Wabbajack.Paths; using Wabbajack.Paths.IO; -using System.Linq; namespace Wabbajack { From c8bce3a84984432ed37e695bda6e7467b26fac30 Mon Sep 17 00:00:00 2001 From: Aidan M Date: Fri, 5 Jul 2024 12:13:31 +0100 Subject: [PATCH 4/4] Change `String` to `string` to align more with overall style --- Wabbajack.App.Wpf/Util/UIUtils.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Wabbajack.App.Wpf/Util/UIUtils.cs b/Wabbajack.App.Wpf/Util/UIUtils.cs index 53e45eff..b4fc10ac 100644 --- a/Wabbajack.App.Wpf/Util/UIUtils.cs +++ b/Wabbajack.App.Wpf/Util/UIUtils.cs @@ -66,7 +66,7 @@ namespace Wabbajack public static void OpenFolder(AbsolutePath path) { - String folderPath = path.ToString(); + string folderPath = path.ToString(); if (!folderPath.EndsWith(Path.DirectorySeparatorChar.ToString())) { folderPath += Path.DirectorySeparatorChar.ToString();