File tree Expand file tree Collapse file tree 1 file changed +23
-1
lines changed
Expand file tree Collapse file tree 1 file changed +23
-1
lines changed Original file line number Diff line number Diff line change 55using System . Text . RegularExpressions ;
66using System . Collections . Specialized ;
77using System . Diagnostics ;
8+ using System . Runtime . InteropServices ;
89
910namespace MinecraftClient . Protocol
1011{
@@ -91,7 +92,28 @@ public static void OpenBrowser(string link)
9192 {
9293 try
9394 {
94- Process . Start ( link ) ;
95+ if ( RuntimeInformation . IsOSPlatform ( OSPlatform . Windows ) )
96+ {
97+ var ps = new ProcessStartInfo ( link )
98+ {
99+ UseShellExecute = true ,
100+ Verb = "open"
101+ } ;
102+
103+ Process . Start ( ps ) ;
104+ }
105+ else if ( RuntimeInformation . IsOSPlatform ( OSPlatform . Linux ) )
106+ {
107+ Process . Start ( "xdg-open" , link ) ;
108+ }
109+ else if ( RuntimeInformation . IsOSPlatform ( OSPlatform . OSX ) )
110+ {
111+ Process . Start ( "open" , link ) ;
112+ }
113+ else
114+ {
115+ ConsoleIO . WriteLine ( "Platform not supported, open up the link manually: " + link ) ;
116+ }
95117 }
96118 catch ( Exception e )
97119 {
You can’t perform that action at this time.
0 commit comments