mirror of
https://github.com/sourcegit-scm/sourcegit.git
synced 2024-12-24 20:57:19 -08:00
code_style: simpfy FindTerminal
* [macOS] should return `string.Empty` when failed to find terminal path * [Linux] use `shell.Type` instead of `shell.Exec` to skip custom terminal detection
This commit is contained in:
parent
9c6745c271
commit
69b39dac6c
2 changed files with 3 additions and 12 deletions
|
@ -26,19 +26,10 @@ namespace SourceGit.Native
|
|||
|
||||
public string FindTerminal(Models.ShellOrTerminal shell)
|
||||
{
|
||||
if (string.IsNullOrEmpty(shell.Exec))
|
||||
if (shell.Type.Equals("custom", StringComparison.Ordinal))
|
||||
return string.Empty;
|
||||
|
||||
var pathVariable = Environment.GetEnvironmentVariable("PATH") ?? string.Empty;
|
||||
var pathes = pathVariable.Split(Path.PathSeparator, StringSplitOptions.RemoveEmptyEntries);
|
||||
foreach (var path in pathes)
|
||||
{
|
||||
var test = Path.Combine(path, shell.Exec);
|
||||
if (File.Exists(test))
|
||||
return test;
|
||||
}
|
||||
|
||||
return string.Empty;
|
||||
return FindExecutable(shell.Exec);
|
||||
}
|
||||
|
||||
public List<Models.ExternalTool> FindExternalTools()
|
||||
|
|
|
@ -34,7 +34,7 @@ namespace SourceGit.Native
|
|||
return "iTerm";
|
||||
}
|
||||
|
||||
return "InvalidTerminal";
|
||||
return string.Empty;
|
||||
}
|
||||
|
||||
public List<Models.ExternalTool> FindExternalTools()
|
||||
|
|
Loading…
Reference in a new issue