mirror of
https://github.com/sourcegit-scm/sourcegit
synced 2025-05-22 12:45:00 +00:00
refactor: a new way to test if this app should be launched as a SSH askpass client
This commit is contained in:
parent
b6ce2bcc85
commit
6151f4dc5f
2 changed files with 12 additions and 18 deletions
|
@ -516,20 +516,18 @@ namespace SourceGit
|
|||
|
||||
private bool TryLaunchedAsAskpass(IClassicDesktopStyleApplicationLifetime desktop)
|
||||
{
|
||||
var launchAsAskpass = Environment.GetEnvironmentVariable("SOURCEGIT_LAUNCH_AS_ASKPASS");
|
||||
if (launchAsAskpass is not "TRUE")
|
||||
return false;
|
||||
|
||||
var args = desktop.Args;
|
||||
if (args == null || args.Length != 1)
|
||||
return false;
|
||||
if (args.Length > 0)
|
||||
{
|
||||
desktop.MainWindow = new Views.Askpass(args[0]);
|
||||
return true;
|
||||
}
|
||||
|
||||
var param = args[0];
|
||||
if (Directory.Exists(param))
|
||||
return false;
|
||||
|
||||
if (!param.StartsWith("enter passphrase", StringComparison.OrdinalIgnoreCase) &&
|
||||
!param.Contains(" password", StringComparison.OrdinalIgnoreCase))
|
||||
return false;
|
||||
|
||||
desktop.MainWindow = new Views.Askpass(param);
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
private void TryLaunchedAsNormal(IClassicDesktopStyleApplicationLifetime desktop)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue