diff --git a/collects/racket/runtime-path.rkt b/collects/racket/runtime-path.rkt index 207da5c5a1..b92d79721f 100644 --- a/collects/racket/runtime-path.rkt +++ b/collects/racket/runtime-path.rkt @@ -158,6 +158,12 @@ #'orig-stx id))) ids) + (let ([phase (sub1 (variable-reference->phase (#%variable-reference)))]) + (unless (zero? phase) + (log-warning "warning: ~a: at phase level ~a: ~e" + (syntax-e (syntax-case #'orig-stx () [(id . _) #'id])) + phase + #'orig-stx))) #`(begin (define-values (id ...) (let-values ([(id ...) expr]) diff --git a/collects/scribblings/reference/filesystem.scrbl b/collects/scribblings/reference/filesystem.scrbl index b40ce3dbf9..03169c51e5 100644 --- a/collects/scribblings/reference/filesystem.scrbl +++ b/collects/scribblings/reference/filesystem.scrbl @@ -536,6 +536,15 @@ If a path is needed only on some platforms and not on others, use @racket[define-runtime-path-list] with an @racket[expr] that produces an empty list on platforms where the path is not needed. +Beware that @racket[define-runtime-path] in a @tech{phase level} other +than 0 does not cooperate properly with an executable creator. To work +around that limitation, put @racket[define-runtime-path] in a separate +module---perhaps a @tech{submodule} created by @racket[module]---then +export the definition, and then the module containing the definition +can be @racket[require]d into any phase level. Using +@racket[define-runtime-path] in a @tech{phase level} other than 0 +logs a warning at expansion time. + The enclosing path for a @racket[define-runtime-path] is determined as follows from the @racket[define-runtime-path] syntactic form: