setup/dirs: fix for failure to find embedding executable

This commit is contained in:
Matthew Flatt 2012-09-21 07:18:55 -06:00
parent 99274b203a
commit c75c0d9946

View File

@ -152,6 +152,8 @@
;; Extract "lib" location from binary:
(let ([exe (parameterize ([current-directory (system-path* 'orig-dir)])
(find-executable-path (find-system-path 'exec-file)))])
(and
exe
(with-input-from-file exe
(lambda ()
(let ([m (regexp-match (byte-regexp
@ -167,11 +169,13 @@
#f
;; resolve relative directory:
(let ([p (bytes->path (utf-16-bytes->bytes (cadr m)))])
(path->complete-path p dir))))))))]
(path->complete-path p dir)))))))))]
[(macosx)
(let* ([exe (parameterize ([current-directory (system-path* 'orig-dir)])
(let loop ([p (find-executable-path
(find-system-path 'exec-file))])
(and
p
(if (link-exists? p)
(loop (let-values ([(r) (resolve-path p)]
[(dir name dir?) (split-path p)])
@ -179,8 +183,8 @@
(relative-path? r))
(build-path dir r)
r)))
p)))]
[rel (get/set-dylib-path exe "Racket" #f)])
p))))]
[rel (and exe (get/set-dylib-path exe "Racket" #f))])
(cond
[(not rel) #f] ; no framework reference found!?
[(regexp-match