mirror of
https://github.com/sourcegit-scm/sourcegit
synced 2025-05-24 21:54:59 +00:00
feature<OpenTerminal>: support Windows Terminal
This commit is contained in:
parent
f041adb2b3
commit
5e706588a0
6 changed files with 123 additions and 86 deletions
|
@ -1,5 +1,7 @@
|
|||
using Microsoft.Win32;
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
|
||||
|
@ -14,6 +16,13 @@ namespace SourceGit.Views {
|
|||
public string Email { get; set; }
|
||||
public string CRLF { get; set; }
|
||||
|
||||
// https://docs.microsoft.com/en-us/windows/desktop/api/shlwapi/nf-shlwapi-pathfindonpathw
|
||||
// https://www.pinvoke.net/default.aspx/shlwapi.PathFindOnPath
|
||||
[DllImport("shlwapi.dll", CharSet = CharSet.Unicode, SetLastError = false)]
|
||||
private static extern bool PathFindOnPath([In, Out] StringBuilder pszFile, [In] string[] ppszOtherDirs);
|
||||
|
||||
public bool EnableWindowsTerminal { get; set; } = PathFindOnPath(new StringBuilder("wt.exe"), null);
|
||||
|
||||
public Preference() {
|
||||
if (Models.Preference.Instance.IsReady) {
|
||||
User = new Commands.Config().Get("user.name");
|
||||
|
@ -26,6 +35,10 @@ namespace SourceGit.Views {
|
|||
CRLF = "false";
|
||||
}
|
||||
|
||||
if (!EnableWindowsTerminal) {
|
||||
Models.Preference.Instance.General.UseWindowsTerminal = false;
|
||||
}
|
||||
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue