original commit: c80d7eedc4344a9046f0f2203f2f8121203090a8
This commit is contained in:
Matthew Flatt 2001-12-16 18:24:26 +00:00
parent f572bc2262
commit 6f5839998d

View File

@ -8,6 +8,16 @@
(case (system-type)
[(macos macosx)
(send-event "MACS" "GURL" "GURL" str)] ;; actually, I think GURL means something slightly different...
[(windows)
;; Try to get a MrEd function...
(let ([get-res (with-handlers ([not-break-exn? (lambda (x) #f)])
(dynamic-require '(lib "mred.ss" "mred") 'get-resource))])
(if get-res
(let ([b (box "")])
(unless (get-res "HKEY_CLASSES_ROOT" "htmlfile\\shell\\open\\command" b)
(error 'send-url "couldn't find URL opener in the registry"))
(system (format "~a ~a" (unbox b) str)))
(error 'send-url "don't know how to open URL in Windows without MrEd")))]
[(unix)
(cond
[(find-executable-path "opera" #f)
@ -15,8 +25,12 @@
(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))]
(let-values ([(out in id err status) (apply
values
(process* browser-path "-remote" (format "openURL(~a)" str)))])
(close-output-port in)
(close-input-port out)
(close-input-port err)))]
[(find-executable-path "netscape" #f)
=>
(lambda (browser-path)
@ -28,5 +42,5 @@
(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))])))
(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))])))