mirror of
https://github.com/sourcegit-scm/sourcegit.git
synced 2024-12-25 21:07:20 -08:00
enhance: allow terminal without full path and adjust error message
This commit is contained in:
parent
4deac98c4e
commit
53c915578e
3 changed files with 13 additions and 5 deletions
|
@ -2,6 +2,7 @@
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
|
using System.Linq.Expressions;
|
||||||
using System.Runtime.Versioning;
|
using System.Runtime.Versioning;
|
||||||
|
|
||||||
using Avalonia;
|
using Avalonia;
|
||||||
|
@ -71,9 +72,9 @@ namespace SourceGit.Native
|
||||||
|
|
||||||
public void OpenTerminal(string workdir)
|
public void OpenTerminal(string workdir)
|
||||||
{
|
{
|
||||||
if (string.IsNullOrEmpty(OS.ShellOrTerminal) || !File.Exists(OS.ShellOrTerminal))
|
if (string.IsNullOrEmpty(OS.ShellOrTerminal))
|
||||||
{
|
{
|
||||||
App.RaiseException(workdir, $"Can not found terminal! Please confirm that the correct shell/terminal has been configured.");
|
App.RaiseException(workdir, $"Terminal is not specified! Please confirm that the correct shell/terminal has been configured.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -81,8 +82,15 @@ namespace SourceGit.Native
|
||||||
var home = Environment.GetFolderPath(Environment.SpecialFolder.UserProfile);
|
var home = Environment.GetFolderPath(Environment.SpecialFolder.UserProfile);
|
||||||
startInfo.WorkingDirectory = string.IsNullOrEmpty(workdir) ? home : workdir;
|
startInfo.WorkingDirectory = string.IsNullOrEmpty(workdir) ? home : workdir;
|
||||||
startInfo.FileName = OS.ShellOrTerminal;
|
startInfo.FileName = OS.ShellOrTerminal;
|
||||||
|
try
|
||||||
|
{
|
||||||
Process.Start(startInfo);
|
Process.Start(startInfo);
|
||||||
}
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
App.RaiseException(workdir, e.Message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void OpenWithDefaultEditor(string file)
|
public void OpenWithDefaultEditor(string file)
|
||||||
{
|
{
|
||||||
|
|
|
@ -95,7 +95,7 @@ namespace SourceGit.Native
|
||||||
public static void OpenTerminal(string workdir)
|
public static void OpenTerminal(string workdir)
|
||||||
{
|
{
|
||||||
if (string.IsNullOrEmpty(ShellOrTerminal))
|
if (string.IsNullOrEmpty(ShellOrTerminal))
|
||||||
App.RaiseException(workdir, $"Can not found terminal! Please confirm that the correct shell/terminal has been configured.");
|
App.RaiseException(workdir, $"Terminal is not specified! Please confirm that the correct shell/terminal has been configured.");
|
||||||
else
|
else
|
||||||
_backend.OpenTerminal(workdir);
|
_backend.OpenTerminal(workdir);
|
||||||
}
|
}
|
||||||
|
|
|
@ -160,7 +160,7 @@ namespace SourceGit.Native
|
||||||
{
|
{
|
||||||
if (string.IsNullOrEmpty(OS.ShellOrTerminal) || !File.Exists(OS.ShellOrTerminal))
|
if (string.IsNullOrEmpty(OS.ShellOrTerminal) || !File.Exists(OS.ShellOrTerminal))
|
||||||
{
|
{
|
||||||
App.RaiseException(workdir, $"Can not found terminal! Please confirm that the correct shell/terminal has been configured.");
|
App.RaiseException(workdir, $"Terminal is not specified! Please confirm that the correct shell/terminal has been configured.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue