Navigation Menu

Skip to content

Commit

Permalink
racket-doc: Use net/url to encode url in find-help/mac (#268)
Browse files Browse the repository at this point in the history
Previously, find-help/mac would fail  to display files in
`/Applications/Racket v6.9/...` i.e. the default installation
path. The browser was Firefox.
  • Loading branch information
kalbr authored and Greg Hendershott committed Jun 7, 2017
1 parent 7aef319 commit 02fe949
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions help.rkt
Expand Up @@ -3,6 +3,7 @@
(require (only-in help/help-utils find-help)
(only-in help/search perform-search)
json
net/url
racket/contract
racket/file
racket/format
Expand Down Expand Up @@ -57,10 +58,10 @@
(define (find-help/mac stx)
(let-values ([(path anchor) (binding->path+anchor stx)])
(and path anchor
(let ([path (path->string (path->complete-path path))])
(browse-file-url/mac @~a{file://@|path|#@anchor}
(force mac-browser))))))

(let ([path-url (path->url (path->complete-path path))])
(browse-file-url/mac
(url->string (struct-copy url path-url [fragment anchor]))
(force mac-browser))))))
(define osascript (delay/sync (find-executable-path "osascript" #f)))
(define (browse-file-url/mac file-url browser)
;; Note: Unlike `send-url/mac`, we also do an "activate" to show the
Expand Down

0 comments on commit 02fe949

Please sign in to comment.