From a53ffb60611cd8a78a0157127b1b2bd44123d39b Mon Sep 17 00:00:00 2001 From: Jon <> Date: Tue, 13 May 2025 09:07:10 +0100 Subject: [PATCH 1/2] Use the correct working directory when running a file --- NoFences/Model/FenceEntry.cs | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/NoFences/Model/FenceEntry.cs b/NoFences/Model/FenceEntry.cs index c842719..e25fcc0 100644 --- a/NoFences/Model/FenceEntry.cs +++ b/NoFences/Model/FenceEntry.cs @@ -53,10 +53,16 @@ public void Open() // start asynchronously try { - if (Type == EntryType.File) - Process.Start(Path); - else if (Type == EntryType.Folder) - Process.Start("explorer.exe", Path); + ProcessStartInfo psi = new ProcessStartInfo(); + psi.FileName = Path; + psi.WorkingDirectory = System.IO.Path.GetDirectoryName(Path); + if (Type == EntryType.Folder) + { + psi.WorkingDirectory = Path; + psi.Arguments = Path; + psi.FileName = "explorer.exe"; + } + Process.Start(psi); } catch (Exception e) { From e0eb08119018c9c9a124ff70a4f863912c90e106 Mon Sep 17 00:00:00 2001 From: Jon <> Date: Tue, 13 May 2025 09:10:53 +0100 Subject: [PATCH 2/2] Keep same working dir for folders --- NoFences/Model/FenceEntry.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/NoFences/Model/FenceEntry.cs b/NoFences/Model/FenceEntry.cs index e25fcc0..6fb6616 100644 --- a/NoFences/Model/FenceEntry.cs +++ b/NoFences/Model/FenceEntry.cs @@ -58,7 +58,6 @@ public void Open() psi.WorkingDirectory = System.IO.Path.GetDirectoryName(Path); if (Type == EntryType.Folder) { - psi.WorkingDirectory = Path; psi.Arguments = Path; psi.FileName = "explorer.exe"; }