code_review: PR #495
Some checks are pending
Continuous Integration / Build (push) Waiting to run
Continuous Integration / Prepare version string (push) Waiting to run
Continuous Integration / Package (push) Blocked by required conditions

* correct the path passed to `--cwd`
This commit is contained in:
leo 2024-09-20 21:59:40 +08:00
parent e011b1807a
commit 30765cf7b3
No known key found for this signature in database

View file

@ -66,13 +66,15 @@ namespace SourceGit.Native
public void OpenTerminal(string workdir) public void OpenTerminal(string workdir)
{ {
var startInfo = new ProcessStartInfo();
var home = Environment.GetFolderPath(Environment.SpecialFolder.UserProfile); var home = Environment.GetFolderPath(Environment.SpecialFolder.UserProfile);
startInfo.WorkingDirectory = string.IsNullOrEmpty(workdir) ? home : workdir; var cwd = string.IsNullOrEmpty(workdir) ? home : workdir;
var startInfo = new ProcessStartInfo();
startInfo.WorkingDirectory = cwd;
startInfo.FileName = OS.ShellOrTerminal; startInfo.FileName = OS.ShellOrTerminal;
if (OS.ShellOrTerminal.EndsWith("wezterm", StringComparison.OrdinalIgnoreCase)) if (OS.ShellOrTerminal.EndsWith("wezterm", StringComparison.OrdinalIgnoreCase))
startInfo.Arguments = $"start --cwd \"{workdir}\""; startInfo.Arguments = $"start --cwd \"{cwd}\"";
try try
{ {