Racket users,
Many software applications use their location in the filesystem
to establish filesystem relationships between their executable
file, their configuration and their data. For this purpose, C
provides the first element of the string array provided to main,
python provides __file__, bash provides ${BASH_SOURCE[0]}, etc.
Racket strips said value before current-command-line-arguments
receives the subsequent command-line arguments from the
operating system.
A related value can be pulled from syntax-source as follows:
(define-syntax (get-current-source stx)
(datum->syntax
(quote-syntax here)
(syntax-source stx)
stx))
Macro get-current-source works as intended if called at program
startup and the program is compiled on the fly with:
racket program.rkt
However get-current-source has the unintended property of memorizing the original source location if the program is compiled with raco exe (and then moved).
Is there a way in racket to obtain the path of the application program?
Jeff Henrikson