Skip to content

Commit

Permalink
Merge pull request #23 from /issues/12-HeadlessLogin
Browse files Browse the repository at this point in the history
  • Loading branch information
tpill90 committed Mar 15, 2023
2 parents 346dd59 + 62732ac commit 7ec0c99
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions EpicPrefill/Handlers/UserAccountManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -109,25 +109,25 @@ public void Save()
JsonSerializer.Serialize(fileStream, OauthToken, SerializationContext.Default.OauthToken);
}

//TODO this likely won't work correctly from linux command line
private void OpenUrl(string url)
{
// hack because of this: https://github.com/dotnet/corefx/issues/10361
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
{
url = url.Replace("&", "^&");
Process.Start(new ProcessStartInfo(url) { UseShellExecute = true });
}
else if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
{
try
// Detects to see if the user is running in a "desktop environment"/GUI, or if they are running in a terminal session.
// Won't be able to launch a web browser without a GUI
// https://en.wikipedia.org/wiki/Desktop_environment
var currDesktopEnvironment = Environment.GetEnvironmentVariable("XDG_CURRENT_DESKTOP");
if (String.IsNullOrEmpty(currDesktopEnvironment))
{
Process.Start("xdg-open", url);
return;
}
catch (Exception)
{

}
Process.Start("xdg-open", url);
}
else if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
{
Expand Down

0 comments on commit 7ec0c99

Please sign in to comment.