diff --git a/Wox.Plugin/SharedCommands/SearchWeb.cs b/Wox.Plugin/SharedCommands/SearchWeb.cs index 52a79a51b5..f91025bffd 100644 --- a/Wox.Plugin/SharedCommands/SearchWeb.cs +++ b/Wox.Plugin/SharedCommands/SearchWeb.cs @@ -36,22 +36,19 @@ namespace Wox.Plugin.SharedCommands /// Opens search as a tab in the default browser chosen in Windows settings. /// public static void NewTabInBrowser(this string url, string browserPath) - { - var browserExecutableName = browserPath? - .Split(new[] { Path.DirectorySeparatorChar }, StringSplitOptions.None) - .Last(); - - var selectedBrowserPath = string.IsNullOrEmpty(browserExecutableName) ? "" : browserPath; - - OpenWebSearch(selectedBrowserPath, "", url); - } - - private static void OpenWebSearch(string chosenBrowser, string browserArguements, string url) { try { - Process.Start(chosenBrowser, browserArguements + url); + if (!string.IsNullOrEmpty(browserPath)) + { + Process.Start(browserPath, url); + } + else + { + Process.Start(url); + } } + // This error may be thrown for Process.Start(browserPath, url) catch (System.ComponentModel.Win32Exception) { Process.Start(url);