/usr/share/racket/pkgs/contract-profile/dot.rkt is in racket-common 6.3-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 | #lang racket/base
;; Graphviz support
;; inspired by redex/private/dot.rkt (can't use directly because it uses GUI)
(require racket/system "utils.rkt")
(provide render-dot)
;; these paths are explicitly checked (when find-executable-path
;; fails) because starting drracket from the finder (or the dock)
;; under mac os x generally does not get the path right.
(define dot-paths
'("/usr/bin"
"/bin"
"/usr/local/bin"
"/opt/local/bin/"))
(define dot.exe (if (eq? (system-type) 'windows) "dot.exe" "dot"))
(define dot
(with-handlers ([(lambda (e) ; may not have permission
(and (exn:fail? e)
(regexp-match "access denied" (exn-message e))))
(lambda _ #f)])
(or (find-executable-path dot.exe)
(ormap (λ (x)
(define candidate (build-path x dot.exe))
(and (file-exists? candidate) candidate))
dot-paths))))
(define (render-dot input-file)
(when (and dot (not (dry-run?)))
(system (format "~a -Tpdf -O ~a" (path->string dot) input-file))))
|