|
|
@ -24,10 +24,10 @@
|
|
|
|
[(not maybe-dir) (current-directory)]
|
|
|
|
[(not maybe-dir) (current-directory)]
|
|
|
|
[(directory-exists? maybe-dir) maybe-dir]
|
|
|
|
[(directory-exists? maybe-dir) maybe-dir]
|
|
|
|
[else (define dir (dirname maybe-dir))
|
|
|
|
[else (define dir (dirname maybe-dir))
|
|
|
|
(and (not (eq? 'relative dir)) (simple-form-path dir (current-directory)))]))
|
|
|
|
(and (not (eq? 'relative dir)) (simplify-path (path->complete-path dir (current-directory))))]))
|
|
|
|
(let loop ([dir starting-dir][path default-directory-require])
|
|
|
|
(let loop ([dir starting-dir][path default-directory-require])
|
|
|
|
(and dir ; dir is #f when it hits the top of the filesystem
|
|
|
|
(and dir ; dir is #f when it hits the top of the filesystem
|
|
|
|
(let ([simplified-path (simple-form-path (path->complete-path path starting-dir))])
|
|
|
|
(let ([simplified-path (simplify-path (path->complete-path path starting-dir))])
|
|
|
|
(if (file-exists? simplified-path)
|
|
|
|
(if (file-exists? simplified-path)
|
|
|
|
simplified-path
|
|
|
|
simplified-path
|
|
|
|
(loop (dirname dir) (build-path 'up path)))))))
|
|
|
|
(loop (dirname dir) (build-path 'up path)))))))
|
|
|
|