enhance: allow to specify custom terminal

This commit is contained in:
Aikawa Yataro 2024-09-16 12:03:56 +00:00
parent 53c915578e
commit 736ad02991
No known key found for this signature in database
GPG key ID: 1C5D95FB10179404
2 changed files with 6 additions and 1 deletions

View file

@ -54,6 +54,7 @@ namespace SourceGit.Models
new ShellOrTerminal("deepin-terminal", "Deepin Terminal", "deepin-terminal"),
new ShellOrTerminal("mate-terminal", "MATE Terminal", "mate-terminal"),
new ShellOrTerminal("foot", "Foot", "foot"),
new ShellOrTerminal("custom", "Custom", ""),
};
}
}

View file

@ -2,7 +2,6 @@
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq.Expressions;
using System.Runtime.Versioning;
using Avalonia;
@ -27,6 +26,11 @@ namespace SourceGit.Native
public string FindTerminal(Models.ShellOrTerminal shell)
{
if (string.IsNullOrEmpty(shell.Exec))
{
return string.Empty;
}
var pathVariable = Environment.GetEnvironmentVariable("PATH") ?? string.Empty;
var pathes = pathVariable.Split(Path.PathSeparator, StringSplitOptions.RemoveEmptyEntries);
foreach (var path in pathes)