Hi all,<br><br>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'?<br>
<br>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':<br><br> read-data:
data-file:"...\test-path\test-distrib\.\lib\plt\test-path\exts\ert\...\test-path\data.txt"<br>
<br>is very different from the directory used by both the source module and the executable generated by 'raco exe': <br><br> read-data: data-file:"...\test-path\data.txt".<br><br>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?<br>
<br>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?<br>
<br>Thanks in advanced for any advice.<br><br>Cheers,<br><br>Kieron.<br><br>****<br><br>#lang racket<br><br>; Access a file "data.txt" at run-time that is originally<br>; located in the same directory as the module source file:<br>
(define-runtime-path data-file "data.txt")<br>(define (read-data)<br> (with-input-from-file data-file<br> (lambda ()<br> (read-bytes (file-size data-file)))))<br><br>