net-lib/net/sendurl.rkt: remove systype function
XonX is defunct, so this function is no longer needed.
This commit is contained in:
parent
83ae4cd9a4
commit
e4d43fa0dc
|
@ -68,16 +68,6 @@
|
||||||
(define (browser-preference? x)
|
(define (browser-preference? x)
|
||||||
(or (not x) (memq x unix-browser-list) (custom-browser? x) (procedure? x)))
|
(or (not x) (memq x unix-browser-list) (custom-browser? x) (procedure? x)))
|
||||||
|
|
||||||
;; like (system-type), but return the real OS for OSX with XonX
|
|
||||||
;; (could do the same for Cygwin, but it doesn't have shell-execute)
|
|
||||||
(define systype
|
|
||||||
(delay/sync (let ([t (system-type)])
|
|
||||||
(cond [(not (eq? t 'unix)) t]
|
|
||||||
[(regexp-match? #rx"-darwin($|/)"
|
|
||||||
(path->string (system-library-subpath)))
|
|
||||||
'macosx]
|
|
||||||
[else t]))))
|
|
||||||
|
|
||||||
(define (%escape str)
|
(define (%escape str)
|
||||||
(apply string-append
|
(apply string-append
|
||||||
(map (lambda (b)
|
(map (lambda (b)
|
||||||
|
@ -93,24 +83,23 @@
|
||||||
;; send-url : str [bool] -> void
|
;; send-url : str [bool] -> void
|
||||||
(define (send-url url-str [separate-window? separate-by-default?]
|
(define (send-url url-str [separate-window? separate-by-default?]
|
||||||
#:escape? [escape? #t])
|
#:escape? [escape? #t])
|
||||||
(define stype (force systype))
|
|
||||||
(unless (string? url-str)
|
(unless (string? url-str)
|
||||||
(error 'send-url "expected a string, got ~e" url-str))
|
(error 'send-url "expected a string, got ~e" url-str))
|
||||||
(let ([url-str (if escape? (escape-url url-str) url-str)])
|
(let ([url-str (if escape? (escape-url url-str) url-str)])
|
||||||
(if (procedure? (external-browser))
|
(if (procedure? (external-browser))
|
||||||
((external-browser) url-str)
|
((external-browser) url-str)
|
||||||
(case stype
|
(case (system-type)
|
||||||
[(macosx) (send-url/mac url-str)]
|
['macosx (send-url/mac url-str)]
|
||||||
[(windows) (send-url/win url-str)]
|
['windows (send-url/win url-str)]
|
||||||
[(unix) (send-url/unix url-str (force separate-window?))]
|
['unix (send-url/unix url-str (force separate-window?))]
|
||||||
[else (error 'send-url
|
[else (error 'send-url
|
||||||
"don't know how to open URL on platform: ~s" stype)])))
|
"don't know how to open URL on platform: ~s" (system-type))])))
|
||||||
(void))
|
(void))
|
||||||
|
|
||||||
(define (send-url/file path [separate-window? separate-by-default?]
|
(define (send-url/file path [separate-window? separate-by-default?]
|
||||||
#:fragment [fragment #f] #:query [query #f])
|
#:fragment [fragment #f] #:query [query #f])
|
||||||
(let* ([path (path->string (path->complete-path path))]
|
(let* ([path (path->string (path->complete-path path))]
|
||||||
[path (if (eq? 'windows (force systype))
|
[path (if (eq? 'windows (system-type))
|
||||||
;; see http://msdn2.microsoft.com/en-us/library/ms775098.aspx
|
;; see http://msdn2.microsoft.com/en-us/library/ms775098.aspx
|
||||||
(let* ([path (regexp-replace* #rx"\\\\" path "/")]
|
(let* ([path (regexp-replace* #rx"\\\\" path "/")]
|
||||||
[slashes (cdar (regexp-match-positions #rx"^/*" path))])
|
[slashes (cdar (regexp-match-positions #rx"^/*" path))])
|
||||||
|
|
Loading…
Reference in New Issue
Block a user