From 39b09735a208cb34979ad6809da488d4621a8caa Mon Sep 17 00:00:00 2001 From: Matthew Flatt Date: Wed, 26 Apr 2006 12:56:54 +0000 Subject: [PATCH] write exe-relative paths to main exe for Mac OS X svn: r2796 --- collects/compiler/embed-unit.ss | 17 ++++++++++++++--- collects/launcher/doc.txt | 7 +++---- 2 files changed, 17 insertions(+), 7 deletions(-) diff --git a/collects/compiler/embed-unit.ss b/collects/compiler/embed-unit.ss index 8005b027eb..b07ca1d5e8 100644 --- a/collects/compiler/embed-unit.ss +++ b/collects/compiler/embed-unit.ss @@ -248,7 +248,7 @@ resource-files)) (build-path dest "Contents" "MacOS" name))) - (define (finish-osx-mred dest flags exec-name keep-exe?) + (define (finish-osx-mred dest flags exec-name keep-exe? relative?) (call-with-output-file (build-path dest "Contents" "Resources" @@ -257,7 +257,16 @@ (write-plist `(dict ,@(if keep-exe? `((assoc-pair "executable name" - ,(path->string exec-name))) + ,(path->string + (if relative? + (let ([p (find-relative-path + (let-values ([(dir name dir?) (split-path (normalize-path dest))]) + dir) + (normalize-path exec-name))]) + (if (relative-path? p) + (build-path 'up 'up 'up p) + p)) + exec-name)))) null) (assoc-pair "stored arguments" (array ,@flags))) @@ -607,7 +616,9 @@ (list "-k" start-s end-s)) cmdline)]) (if osx? - (finish-osx-mred dest full-cmdline exe keep-exe?) + (finish-osx-mred dest full-cmdline exe keep-exe? + (let ([m (assq 'relative? aux)]) + (and m (cdr m)))) (let ([cmdpos (with-input-from-file dest-exe (lambda () (find-cmdline "cmdline" diff --git a/collects/launcher/doc.txt b/collects/launcher/doc.txt index f2c23ea82d..86e6d250d2 100644 --- a/collects/launcher/doc.txt +++ b/collects/launcher/doc.txt @@ -37,10 +37,9 @@ executables. script will call (ignoring `args'); if this name is not provided, the script will go through the MrEd executable - _'relative?_ (Unix, Mac OS X Mzscheme or 'script[-3m] variant, - or Windows in 'independent? mode) - a boolean, where #t - means that the generate shell script should launch the - executable through a relative path + _'relative?_ (all) - a boolean, where #t means that the generate + shell script should launch the executable through a + relative path See also `build-aux-from-path' below. The default `aux' is `null'.