1#lang racket/base
2
3;; Similar to "../path-relativize.rkt", but works on already-releative
4;; paths and allows ".." in the path.
5
6(provide encode-relative-path
7         decode-relative-path)
8
9(define (encode-relative-path p)
10  (cons 'rel
11        (for/list ([e (in-list (explode-path p))])
12          (if (path? e)
13              (path-element->bytes e)
14              e))))
15
16(define (decode-relative-path l)
17  (apply build-path
18         (for/list ([e (in-list (cdr l))])
19           (if (bytes? e)
20               (bytes->path-element e)
21               e))))
22