mirror of
https://github.com/sourcegit-scm/sourcegit
synced 2025-05-22 04:34:59 +00:00
feature: external editor supports visual studio code insiders; add environment variable VSCODE_PATH
and FLEET_PATH
to help to find these editors. (#54) (#55)
This commit is contained in:
parent
eea3d2c6c0
commit
0252887442
5 changed files with 79 additions and 12 deletions
|
@ -1,5 +1,6 @@
|
|||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
|
||||
using Avalonia;
|
||||
|
||||
|
@ -47,7 +48,12 @@ namespace SourceGit.Native
|
|||
}
|
||||
|
||||
VSCodeExecutableFile = _backend.FindVSCode();
|
||||
if (string.IsNullOrEmpty(VSCodeExecutableFile))
|
||||
VSCodeExecutableFile = GetPathFromEnvironmentVar("VSCODE_PATH");
|
||||
|
||||
FleetExecutableFile = _backend.FindFleet();
|
||||
if (string.IsNullOrEmpty(FleetExecutableFile))
|
||||
FleetExecutableFile = GetPathFromEnvironmentVar("FLEET_PATH");
|
||||
}
|
||||
|
||||
public static void SetupApp(AppBuilder builder)
|
||||
|
@ -114,6 +120,17 @@ namespace SourceGit.Native
|
|||
});
|
||||
}
|
||||
|
||||
private static string GetPathFromEnvironmentVar(string key)
|
||||
{
|
||||
var customPath = Environment.GetEnvironmentVariable(key);
|
||||
if (!string.IsNullOrEmpty(customPath) && File.Exists(customPath))
|
||||
{
|
||||
return customPath;
|
||||
}
|
||||
|
||||
return string.Empty;
|
||||
}
|
||||
|
||||
private static readonly IBackend _backend;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue