/usr/share/racket/collects/syntax/path-spec.rkt is in racket-common 6.3-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 | (module path-spec racket/base
(require (for-template racket/base))
(provide resolve-path-spec)
(define (resolve-path-spec fn loc stx)
(let ([file
(syntax-case fn (lib file)
[_
(string? (syntax-e fn))
(let ([s (syntax-e fn)])
(unless (module-path? s)
(raise-syntax-error
#f
"bad relative pathname string"
stx
fn))
(apply build-path
(regexp-split #rx"/" s)))]
[(file . _)
(let ([l (syntax->datum fn)])
(unless (module-path? l)
(raise-syntax-error
#f
"bad `file' path"
stx
fn))
(string->path (cadr l)))]
[(lib . _)
(let ([l (syntax->datum fn)])
(unless (module-path? l)
(raise-syntax-error
#f
"bad `lib' path"
stx
fn))
(let ([s (resolved-module-path-name
(module-path-index-resolve
(module-path-index-join l #f)))])
(if (path? s)
s
(raise-syntax-error
#f
"`lib' path produced symbolic module name"
stx
fn))))]
[else
(raise-syntax-error
#f
"not a pathname string, `file' form, or `lib' form for file"
stx
fn)])])
(if (complete-path? file)
file
(path->complete-path
file
(cond
;; Src of include expression is a path?
[(and (path? (syntax-source loc))
(complete-path? (syntax-source loc)))
(let-values ([(base name dir?)
(split-path (syntax-source loc))])
(if dir?
(syntax-source loc)
base))]
;; Load relative?
[(current-load-relative-directory)]
;; Current directory
[(current-directory)]))))))
|