From 6f5839998df9f3924d28fe1ce94ca7bb24b01224 Mon Sep 17 00:00:00 2001 From: Matthew Flatt Date: Sun, 16 Dec 2001 18:24:26 +0000 Subject: [PATCH] . original commit: c80d7eedc4344a9046f0f2203f2f8121203090a8 --- collects/net/sendurl.ss | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/collects/net/sendurl.ss b/collects/net/sendurl.ss index 6155be0955..280e2ca6d2 100644 --- a/collects/net/sendurl.ss +++ b/collects/net/sendurl.ss @@ -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))])))