fix detection of OSX
svn: r6189
This commit is contained in:
parent
b0ead7f2d6
commit
83f2bdce62
|
@ -27,22 +27,32 @@
|
||||||
x
|
x
|
||||||
(error 'external-browser "~a is not a valid browser preference" x)))))
|
(error 'external-browser "~a is not a valid browser preference" x)))))
|
||||||
|
|
||||||
(define osx-browser?
|
;; like (system-type), but return the real OS for OSX with XonX
|
||||||
(delay (or (eq? (system-type) 'macosx)
|
;; (could do the same for Cygwin, but that it doesn't have shell-execute)
|
||||||
(equal? "ppc-darwin" (path->string (system-library-subpath))))))
|
(define systype
|
||||||
|
(delay (let ([t (system-type)])
|
||||||
|
(cond [(not (eq? t 'unix)) t]
|
||||||
|
[(regexp-match? #rx"-darwin($|/)"
|
||||||
|
(path->string (system-library-subpath)))
|
||||||
|
'macosx]
|
||||||
|
[else t]))))
|
||||||
|
|
||||||
; send-url : str [bool] -> void
|
; send-url : str [bool] -> void
|
||||||
(define/kw (send-url url-str
|
(define/kw (send-url url-str
|
||||||
#:optional [separate-window? separate-by-default?])
|
#:optional [separate-window? separate-by-default?])
|
||||||
(define external (external-browser))
|
(define external (external-browser))
|
||||||
(define stype (system-type))
|
(define stype (force systype))
|
||||||
(cond
|
(cond
|
||||||
[(procedure? external) (external url-str)]
|
[(procedure? external) (external url-str)]
|
||||||
[(force osx-browser?)
|
[(eq? stype 'macosx)
|
||||||
(browser-process (format "osascript -e 'open location \"~a\"'" url-str))]
|
(browser-process
|
||||||
|
(format "osascript -e 'open location \"~a\"'"
|
||||||
|
url-str))]
|
||||||
[(eq? stype 'windows)
|
[(eq? stype 'windows)
|
||||||
(shell-execute #f url-str "" (current-directory) 'SW_SHOWNORMAL)]
|
(shell-execute #f url-str "" (current-directory) 'SW_SHOWNORMAL)]
|
||||||
[(eq? stype 'unix)
|
[(not (eq? stype 'unix))
|
||||||
|
(error 'send-url "don't know how to open URL on platform: ~s" stype)]
|
||||||
|
[else ; unix
|
||||||
(let ([preferred (or external (get-preference 'external-browser))])
|
(let ([preferred (or external (get-preference 'external-browser))])
|
||||||
(cond
|
(cond
|
||||||
[(use-browser 'opera preferred)
|
[(use-browser 'opera preferred)
|
||||||
|
@ -81,9 +91,7 @@
|
||||||
(browser-process cmd))]
|
(browser-process cmd))]
|
||||||
[else
|
[else
|
||||||
(error 'send-url "Couldn't find ~a to open URL: ~e"
|
(error 'send-url "Couldn't find ~a to open URL: ~e"
|
||||||
(orify unix-browser-list) url-str)]))]
|
(orify unix-browser-list) url-str)]))]))
|
||||||
[else (error 'send-url
|
|
||||||
"don't know how to open URL on platform: ~s" stype)]))
|
|
||||||
|
|
||||||
(define unix-browser-list '(opera galeon netscape mozilla dillo))
|
(define unix-browser-list '(opera galeon netscape mozilla dillo))
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user