mirror of
https://github.com/sourcegit-scm/sourcegit.git
synced 2024-12-23 20:47:25 -08:00
fix: Windows Terminal is not a built-in app on Windows 10
This commit is contained in:
parent
5c9b92c3db
commit
3fd1e0ea19
1 changed files with 26 additions and 2 deletions
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue