point to the contract profiler

original commit: 7b26260d998f24fa330447660fa68609eef553ac
This commit is contained in:
Robby Findler 2014-04-14 16:49:40 -05:00
parent 96370d6252
commit a32e1ac4c1

View File

@ -11,6 +11,12 @@
(define neato-hier-label "neato hier") (define neato-hier-label "neato hier")
(define neato-ipsep-label "neato ipsep") (define neato-ipsep-label "neato ipsep")
;; the code that finds the dot executable is the same as
;; pkg/contract-profile/dot.rkt; please check the other
;; place if you find a bug here. the only reason it isn't
;; shared is dependencies and lack of an obvious common
;; place in between to put it.
;; these paths are explicitly checked (when find-executable-path ;; these paths are explicitly checked (when find-executable-path
;; fails) because starting drracket from the finder (or the dock) ;; fails) because starting drracket from the finder (or the dock)
;; under mac os x generally does not get the path right. ;; under mac os x generally does not get the path right.
@ -24,17 +30,20 @@
(define neato.exe (if (eq? (system-type) 'windows) "neato.exe" "neato")) (define neato.exe (if (eq? (system-type) 'windows) "neato.exe" "neato"))
(define (find-dot [neato? #f]) (define (find-dot [neato? #f])
(cond (with-handlers ([(lambda (e) ; may not have permission
[(and (find-executable-path dot.exe) (and (exn:fail? e)
(find-executable-path neato.exe)) (regexp-match "access denied" (exn-message e))))
(if neato? (λ (x) #f)])
(find-executable-path neato.exe) (define dp (find-executable-path dot.exe))
(find-executable-path dot.exe))] (define np (find-executable-path neato.exe))
[else (cond
(ormap (λ (x) (and (file-exists? (build-path x dot.exe)) [(and dp np)
(file-exists? (build-path x neato.exe)) (if neato? np dp)]
(build-path x (if neato? neato.exe dot.exe)))) [else
dot-paths)])) (ormap (λ (x) (and (file-exists? (build-path x dot.exe))
(file-exists? (build-path x neato.exe))
(build-path x (if neato? neato.exe dot.exe))))
dot-paths)])))
(define (dot-positioning pb [option dot-label] [overlap? #f]) (define (dot-positioning pb [option dot-label] [overlap? #f])
(define dot-path (find-dot (regexp-match #rx"neato" option))) (define dot-path (find-dot (regexp-match #rx"neato" option)))