From fd7bc8b1228a8a5fe348dcce6d4ed28d4c021e84 Mon Sep 17 00:00:00 2001 From: Chiahong Hong Date: Thu, 22 Aug 2024 00:57:23 +0800 Subject: [PATCH 1/2] fix: prevent executing an executable file with the same name as the directory --- src/Native/Windows.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Native/Windows.cs b/src/Native/Windows.cs index 7609fe7b..a48efe0a 100644 --- a/src/Native/Windows.cs +++ b/src/Native/Windows.cs @@ -183,6 +183,7 @@ namespace SourceGit.Native else { fullpath = new DirectoryInfo(path!).FullName; + fullpath += Path.DirectorySeparatorChar; } if (select) From 9a1e95b7e502f792b3de210f495a011720c75fd1 Mon Sep 17 00:00:00 2001 From: Chiahong Hong Date: Thu, 22 Aug 2024 02:09:34 +0800 Subject: [PATCH 2/2] fix: handle file paths with spaces --- src/Native/Windows.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Native/Windows.cs b/src/Native/Windows.cs index a48efe0a..18326fa6 100644 --- a/src/Native/Windows.cs +++ b/src/Native/Windows.cs @@ -203,7 +203,7 @@ namespace SourceGit.Native public void OpenWithDefaultEditor(string file) { var info = new FileInfo(file); - var start = new ProcessStartInfo("cmd", $"/c start {info.FullName}"); + var start = new ProcessStartInfo("cmd", $"/c start \"\" \"{info.FullName}\""); start.CreateNoWindow = true; Process.Start(start); }