File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11using ManagedCommon ;
22using System ;
33using System . Collections . Generic ;
4+ using System . Diagnostics ;
45using Wox . Infrastructure ;
56using Wox . Plugin ;
67using BrowserInfo = Wox . Plugin . Common . DefaultBrowserInfo ;
@@ -56,8 +57,19 @@ public List<Result> Query(Query query)
5657 IcoPath = IconPath ,
5758 Action = _ =>
5859 {
59- if ( Helper . OpenCommandInShell ( BrowserInfo . Path , BrowserInfo . ArgumentsPattern ,
60- httpStatus ? . DefinedIn ) ) return true ;
60+ try {
61+ if ( Helper . OpenCommandInShell ( BrowserInfo . Path , BrowserInfo . ArgumentsPattern ,
62+ httpStatus ? . DefinedIn ) ) return true ;
63+ } catch ( InvalidOperationException ) {
64+ // See https://github.com/grzhan/HttpStatusCodePowerToys/issues/3
65+ // In some operating systems (perhaps Windows 10),
66+ // the DefaultBrowserInfo fails to return the correct browser path.
67+ // Therefore, attempt to launch the browser directly based on the URL.
68+ Process . Start ( new ProcessStartInfo ( httpStatus ! . DefinedIn )
69+ {
70+ UseShellExecute = true
71+ } ) ;
72+ }
6173 ErrorHandler . OnPluginError ( ) ;
6274 return false ;
6375 } ,
You can’t perform that action at this time.
0 commit comments