From 678b6e1102944c13a1474cd045910434bb42911f Mon Sep 17 00:00:00 2001 From: Matthew Flatt Date: Sun, 23 Apr 2006 02:47:35 +0000 Subject: [PATCH] new utility for adjust the embedded collects path svn: r2741 --- collects/compiler/private/collects-path.ss | 26 ++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 collects/compiler/private/collects-path.ss diff --git a/collects/compiler/private/collects-path.ss b/collects/compiler/private/collects-path.ss new file mode 100644 index 0000000000..9b06ecfb63 --- /dev/null +++ b/collects/compiler/private/collects-path.ss @@ -0,0 +1,26 @@ + +(module collects-path mzscheme + (provide set-collects-path) + + (define label "coLLECTs dIRECTORy:") + + (define set-collects-path + (case-lambda + [() + (let ([v (current-command-line-arguments)]) + (set-collects-path (vector-ref v 0) (vector-ref v 1)))] + [(dest path) + (let-values ([(i o) (open-input-output-file dest 'update)]) + (let ([m (regexp-match-positions label i)] + [path (if (string? path) + (string->path path) + path)]) + (unless m + (error 'set-collects-path + "cannot find collection-path label in executable file")) + (file-position o (cdar m)) + (write-bytes (path->bytes path) o) + (write-byte 0 o) + (close-input-port i) + (close-output-port o)))]))) + \ No newline at end of file