|
|
|
@ -1,6 +1,7 @@
|
|
|
|
|
#lang racket/base
|
|
|
|
|
(require (for-syntax racket/base racket/syntax)
|
|
|
|
|
racket/runtime-path
|
|
|
|
|
racket/path
|
|
|
|
|
"private/constants.rkt")
|
|
|
|
|
(provide (all-from-out "private/constants.rkt"))
|
|
|
|
|
|
|
|
|
@ -23,10 +24,10 @@
|
|
|
|
|
[(not maybe-dir) (current-directory)]
|
|
|
|
|
[(directory-exists? maybe-dir) maybe-dir]
|
|
|
|
|
[else (define dir (dirname maybe-dir))
|
|
|
|
|
(and (not (eq? 'relative dir)) (path->complete-path dir (current-directory)))]))
|
|
|
|
|
(and (not (eq? 'relative dir)) (simple-form-path dir (current-directory)))]))
|
|
|
|
|
(let loop ([dir starting-dir][path default-directory-require])
|
|
|
|
|
(and dir ; dir is #f when it hits the top of the filesystem
|
|
|
|
|
(let ([simplified-path (simplify-path (path->complete-path path starting-dir))])
|
|
|
|
|
(let ([simplified-path (simple-form-path (path->complete-path path starting-dir))])
|
|
|
|
|
(if (file-exists? simplified-path)
|
|
|
|
|
simplified-path
|
|
|
|
|
(loop (dirname dir) (build-path 'up path)))))))
|
|
|
|
|