Merge pull request #69 from florence/to_relative

closes #48
This commit is contained in:
Spencer Florence 2015-04-05 16:45:23 -04:00
commit 1a9a68b2ef
2 changed files with 6 additions and 9 deletions

View File

@ -1,17 +1,14 @@
#lang racket/base
(provide ->relative ->absolute)
(require racket/list)
(require racket/list racket/path)
(module+ test (require rackunit))
;; PathString -> Path
(define (->relative path)
(simplify-path
(if (relative-path? path)
(build-path path)
(let-values ([(_ lst)
(split-at (explode-path path)
(length (explode-path (current-directory))))])
(apply build-path lst)))))
(build-path
(find-relative-path
(current-directory)
path)))
(module+ test
(parameterize ([current-directory (build-path "/test")])

View File

@ -229,7 +229,7 @@
paths))
(module+ test
(parameterize ([current-directory (build-path "/tests")])
(parameterize ([current-directory (build-path "/test")])
(check-not-false (is-excluded-path? "/test/test/x.rkt" '("test")))
(check-false (is-excluded-path? "/test/x.rkt" '("test")))
(check-false (is-excluded-path? "/test/t/x.rkt" '("test")))))