diff --git a/DanTup.BrowserSelector/BrowserSelector.ini b/DanTup.BrowserSelector/BrowserSelector.ini index 4ce52d4..0f81a25 100644 --- a/DanTup.BrowserSelector/BrowserSelector.ini +++ b/DanTup.BrowserSelector/BrowserSelector.ini @@ -1,6 +1,9 @@ ; Default browser is first in list +; Micrsoft Edge is a UWP app and requires no path [browsers] chrome = C:\Program Files (x86)\Google\Chrome\Application\chrome.exe +ff = C:\Program Files (x86)\Mozilla Firefox\firefox.exe +edge = ie = iexplore.exe ; Url preferences. diff --git a/DanTup.BrowserSelector/Program.cs b/DanTup.BrowserSelector/Program.cs index 3495b17..5754eb9 100644 --- a/DanTup.BrowserSelector/Program.cs +++ b/DanTup.BrowserSelector/Program.cs @@ -1,4 +1,5 @@ using System; +using System.Collections.Generic; using System.Diagnostics; using System.Reflection; using System.Security.Principal; @@ -9,7 +10,12 @@ namespace DanTup.BrowserSelector { class Program { - static void Main(string[] args) + static readonly Dictionary SpecialCommands = new Dictionary + { + {"edge", "microsoft-edge:{0}"} + }; + + static void Main(string[] args) { if (args == null || args.Length != 1 || !HandleArg(args[0])) ShowHelpInfo(); @@ -85,8 +91,11 @@ static void LaunchBrowser(string url) if (Regex.IsMatch(domain, pattern)) { - Process.Start(preference.Browser.Location, url); - return; + if (SpecialCommands.ContainsKey(preference.Browser.Name)) + Process.Start(string.Format(SpecialCommands[preference.Browser.Name], url)); + else + Process.Start(preference.Browser.Location, url); + return; } } diff --git a/DanTup.BrowserSelector/Properties/AssemblyInfo.cs b/DanTup.BrowserSelector/Properties/AssemblyInfo.cs index 4003cbd..65b3ffb 100644 --- a/DanTup.BrowserSelector/Properties/AssemblyInfo.cs +++ b/DanTup.BrowserSelector/Properties/AssemblyInfo.cs @@ -3,5 +3,5 @@ [assembly: AssemblyTitle("DanTup.BrowserSelector")] [assembly: AssemblyProduct("DanTup.BrowserSelector")] [assembly: AssemblyCopyright("Copyright © Danny Tuppeny 2015")] -[assembly: AssemblyVersion("0.2.0.0")] -[assembly: AssemblyFileVersion("0.2.0.0")] +[assembly: AssemblyVersion("0.3.0.0")] +[assembly: AssemblyFileVersion("0.3.0.0")] diff --git a/README.md b/README.md index 767393d..dee4879 100644 --- a/README.md +++ b/README.md @@ -17,8 +17,11 @@ Small utility to launch a different browser depending on the domain of the url b Config is a poor mans INI file: ; Default browser is first in list + ; Micrsoft Edge is a UWP app and requires no path [browsers] chrome = C:\Program Files (x86)\Google\Chrome\Application\chrome.exe + ff = C:\Program Files (x86)\Mozilla Firefox\firefox.exe + edge = ie = iexplore.exe ; Url preferences. @@ -28,10 +31,12 @@ Config is a poor mans INI file: [urls] microsoft.com = ie *.microsoft.com = ie + google.com = chrome + visualstudio.com = edge Notes: -- Browser paths must be exact paths to exes with no arguments (or in `PATH`). Values do not need to be quoted. +- Browser paths must be exact paths to exes with no arguments (or in `PATH`). Values do not need to be quoted. Microsoft Edge is a UWP app which cannot be started like other browsers. The path can thus remain empty. - Only * is treated as a special character in URL patterns, and matches any characters. - Only the domain part (or IP address) of a URL is checked. - There is no implied wildcard at the start or end, so you must include these if you need them, but be aware that "microsoft.*" will not only match "microsoft.com" and "microsoft.co.uk" but also "microsoft.somethingelse.com".