File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -38,28 +38,39 @@ public static class URLHelpers
3838 public static void OpenURL ( string ? url )
3939 {
4040 if ( string . IsNullOrEmpty ( url ) ) return ;
41+
4142 Task . Run ( ( ) =>
4243 {
4344 try
4445 {
45- using var process = new Process ( ) ;
4646 var psi = new ProcessStartInfo
4747 {
48- UseShellExecute = true ,
48+ UseShellExecute = true
4949 } ;
50+
5051 if ( ! string . IsNullOrEmpty ( HelpersOptions . BrowserPath ) )
5152 {
5253 psi . FileName = HelpersOptions . BrowserPath ;
5354 psi . Arguments = url ;
5455 }
56+ else if ( OperatingSystem . IsMacOS ( ) )
57+ {
58+ psi . FileName = "open" ;
59+ psi . Arguments = url ;
60+ psi . UseShellExecute = false ;
61+ }
62+ // else if (OperatingSystem.IsLinux() || OperatingSystem.IsFreeBSD())
63+ // {
64+ // psi.FileName = "xdg-open";
65+ // psi.Arguments = url;
66+ // psi.UseShellExecute = false;
67+ // }
5568 else
5669 {
5770 psi . FileName = url ;
5871 }
5972
60- process . StartInfo = psi ;
61- process . Start ( ) ;
62-
73+ using var process = Process . Start ( psi ) ;
6374 DebugHelper . WriteLine ( "URL opened: " + url ) ;
6475 }
6576 catch ( Exception e )
You can’t perform that action at this time.
0 commit comments