From 962720676431d686069e4ebdf781814f874ba4ee Mon Sep 17 00:00:00 2001 From: leo Date: Sun, 5 May 2024 13:11:47 +0800 Subject: [PATCH] fix: launch terminal in current user's home dir failed on macOS(#105) --- src/Native/MacOS.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Native/MacOS.cs b/src/Native/MacOS.cs index 32cf87a1..465dcdf9 100644 --- a/src/Native/MacOS.cs +++ b/src/Native/MacOS.cs @@ -65,10 +65,12 @@ namespace SourceGit.Native public void OpenTerminal(string workdir) { var dir = string.IsNullOrEmpty(workdir) ? "~" : workdir; + dir = dir.Replace(" ", "\\ "); + var builder = new StringBuilder(); builder.AppendLine("on run argv"); builder.AppendLine(" tell application \"Terminal\""); - builder.AppendLine($" do script \"cd '{dir}'\""); + builder.AppendLine($" do script \"cd {dir}\""); builder.AppendLine(" activate"); builder.AppendLine(" end tell"); builder.AppendLine("end run");