mirror of
https://github.com/MCCTeam/Minecraft-Console-Client
synced 2025-10-14 21:22:49 +00:00
Fix the browser not opening on Linux.
This commit is contained in:
parent
0c0208ac49
commit
05c4661553
1 changed files with 18 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,23 @@ namespace MinecraftClient.Protocol
|
|||
{
|
||||
try
|
||||
{
|
||||
Process.Start(link);
|
||||
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
|
||||
{
|
||||
link = link.Replace("&", "^&");
|
||||
Process.Start(new ProcessStartInfo(link) { UseShellExecute = true });
|
||||
}
|
||||
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