mirror of
https://fastgit.cc/github.com/sourcegit-scm/sourcegit
synced 2026-04-22 13:51:15 +08:00
fix: Windows Terminal is not a built-in app on Windows 10
This commit is contained in:
@@ -168,7 +168,14 @@ namespace SourceGit.Native
|
||||
startInfo.FileName = "cmd";
|
||||
break;
|
||||
case Models.Shell.DefaultShellOfWindowsTerminal:
|
||||
startInfo.FileName = "wt";
|
||||
var wt = FindWindowsTerminalApp();
|
||||
if (!File.Exists(wt))
|
||||
{
|
||||
App.RaiseException(workdir, $"Can NOT found wt.exe on your system!");
|
||||
return;
|
||||
}
|
||||
|
||||
startInfo.FileName = FindWindowsTerminalApp();
|
||||
break;
|
||||
default:
|
||||
App.RaiseException(workdir, $"Bad shell configuration!");
|
||||
@@ -221,7 +228,8 @@ namespace SourceGit.Native
|
||||
// There's two version of PowerShell : pwsh.exe (preferred) and powershell.exe (system default)
|
||||
private string ChoosePowerShell()
|
||||
{
|
||||
if (!string.IsNullOrEmpty(_powershellPath)) return _powershellPath;
|
||||
if (!string.IsNullOrEmpty(_powershellPath))
|
||||
return _powershellPath;
|
||||
|
||||
var localMachine = Microsoft.Win32.RegistryKey.OpenBaseKey(
|
||||
Microsoft.Win32.RegistryHive.LocalMachine,
|
||||
@@ -248,6 +256,21 @@ namespace SourceGit.Native
|
||||
return string.Empty;
|
||||
}
|
||||
|
||||
private string FindWindowsTerminalApp()
|
||||
{
|
||||
if (!string.IsNullOrEmpty(_wtPath))
|
||||
return _wtPath;
|
||||
|
||||
var finder = new StringBuilder("wt.exe", 512);
|
||||
if (PathFindOnPath(finder, null))
|
||||
{
|
||||
_wtPath = finder.ToString();
|
||||
return _wtPath;
|
||||
}
|
||||
|
||||
return string.Empty;
|
||||
}
|
||||
|
||||
#region EXTERNAL_EDITOR_FINDER
|
||||
private string FindVSCode()
|
||||
{
|
||||
@@ -342,5 +365,6 @@ namespace SourceGit.Native
|
||||
}
|
||||
|
||||
private string _powershellPath = string.Empty;
|
||||
private string _wtPath = string.Empty;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user