mirror of
https://github.com/MCCTeam/Minecraft-Console-Client
synced 2025-11-07 17:36:07 +00:00
Fixed the browser not opening on Linux and macOS.
Fixed the browser not opening on Linux and macOS.
This commit is contained in:
commit
e150bd569b
1 changed files with 23 additions and 1 deletions
|
|
@ -5,6 +5,7 @@ using System.Text;
|
|||
using System.Text.RegularExpressions;
|
||||
using System.Collections.Specialized;
|
||||
using System.Diagnostics;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace MinecraftClient.Protocol
|
||||
{
|
||||
|
|
@ -91,7 +92,28 @@ namespace MinecraftClient.Protocol
|
|||
{
|
||||
try
|
||||
{
|
||||
Process.Start(link);
|
||||
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
|
||||
{
|
||||
var ps = new ProcessStartInfo(link)
|
||||
{
|
||||
UseShellExecute = true,
|
||||
Verb = "open"
|
||||
};
|
||||
|
||||
Process.Start(ps);
|
||||
}
|
||||
else if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
|
||||
{
|
||||
Process.Start("xdg-open", link);
|
||||
}
|
||||
else if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
|
||||
{
|
||||
Process.Start("open", link);
|
||||
}
|
||||
else
|
||||
{
|
||||
ConsoleIO.WriteLine("Platform not supported, open up the link manually: " + link);
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue