Hi all,

How do I get a run-time path in the executable created by 'raco distrib',
that is the same, relative to the directory containing the source racket
code and the executable created by 'raco exe'?

When I execute the following code (modified from the documentation), I
observe that the directory for the data file for the executable generated
by 'raco distrib':

   read-data:
data-file:"...\test-path\test-distrib\.\lib\plt\test-path\exts\ert\...\test-path\data.txt"

is very different from the directory used by both the source module and the
executable generated by 'raco exe':

   read-data: data-file:"...\test-path\data.txt".

How do I make the ".\lib\plt\test-path\exts\ert\...\test-path\" go away and
have the data file be packaged in the same directory as the executable?

I need the program to access a data file that I expect an end-user to
modify, and the additional subdirs between where the program and data file
are a bit of a problem. Perhaps I should be using some other approach?

Thanks in advanced for any advice.

Cheers,

Kieron.

****

#lang racket

; Access a file "data.txt" at run-time that is originally
; located in the same directory as the module source file:
(define-runtime-path data-file "data.txt")
(define (read-data)
  (with-input-from-file data-file
    (lambda ()
      (read-bytes (file-size data-file)))))
____________________
  Racket Users list:
  http://lists.racket-lang.org/users

Reply via email to