From 7601ba45decda95556c7513dc6475074d0542f52 Mon Sep 17 00:00:00 2001 From: Sami Date: Thu, 16 Nov 2017 00:10:58 +0100 Subject: [PATCH] Invoke default browser on Windows --- Ooui/Platform.cs | 24 +++++++++--------------- 1 file changed, 9 insertions(+), 15 deletions(-) diff --git a/Ooui/Platform.cs b/Ooui/Platform.cs index 951bd7a..287bfa4 100644 --- a/Ooui/Platform.cs +++ b/Ooui/Platform.cs @@ -132,22 +132,16 @@ namespace Ooui static Process StartBrowserProcess (string url) { - var cmd = url; - var args = ""; + // var vs = Environment.GetEnvironmentVariables (); + // foreach (System.Collections.DictionaryEntry kv in vs) { + // System.Console.WriteLine($"K={kv.Key}, V={kv.Value}"); + // } - var osv = Environment.OSVersion; - if (osv.Platform == PlatformID.Unix) { - cmd = "open"; - args = url; - } + // Console.WriteLine ($"Process.Start {cmd} {args}"); - // var vs = Environment.GetEnvironmentVariables (); - // foreach (System.Collections.DictionaryEntry kv in vs) { - // System.Console.WriteLine($"K={kv.Key}, V={kv.Value}"); - // } - - // Console.WriteLine ($"Process.Start {cmd} {args}"); - return Process.Start (cmd, args); - } + return Environment.OSVersion.Platform == PlatformID.Unix + ? Process.Start ("open", url) + : Process.Start (new ProcessStartInfo (url) { UseShellExecute = true }); + } } }