added opera as first choice under unix

original commit: f2b1feff4945d973fb079af7d306edd4f1f0d9ba
This commit is contained in:
Robby Findler 2001-11-18 18:16:51 +00:00
parent 576769bc3e
commit f572bc2262

View File

@ -9,13 +9,24 @@
[(macos macosx)
(send-event "MACS" "GURL" "GURL" str)] ;; actually, I think GURL means something slightly different...
[(unix)
(let ([netscape-path (find-executable-path "netscape" #f)])
(unless netscape-path
(error 'open-url "Couldn't find Netscape."))
(or (system* netscape-path "-remote" (format "openURL(~a)" str))
(let-values ([(out in id err status) (apply values (process* netscape-path str))])
(close-output-port in)
(close-input-port out)
(close-input-port err))))]
(cond
[(find-executable-path "opera" #f)
=>
(lambda (browser-path)
;; opera may not return -- always open asyncronously
;; opera starts a new browser automatically, if it can't find one
(process* browser-path "-remote" (format "openURL(~a)" str))
(void))]
[(find-executable-path "netscape" #f)
=>
(lambda (browser-path)
;; netscape's -remote returns with an error code, if no
;; netscape is around. start a new netscape in that case.
(or (system* browser-path "-remote" (format "openURL(~a)" str))
(let-values ([(out in id err status) (apply values (process* browser-path str))])
(close-output-port in)
(close-input-port out)
(close-input-port err))))]
[else
(error 'open-url "Couldn't find Netscape or Opera to open url: ~e" str)])]
[else (error 'send-url "don't know how to open url on platform: ~s" (system-type))])))