cs: protect special filenames from directory-list

For example, return `\\?\REL\\aux` instead of `aux`.
This commit is contained in:
Matthew Flatt 2020-07-16 09:16:49 -06:00
parent 9867d11d68
commit 6805145e10
2 changed files with 10 additions and 2 deletions

View File

@ -3,12 +3,14 @@
"../path/complete.rkt"
"../path/parameter.rkt"
"../path/cleanse.rkt"
"../path/protect.rkt"
"../host/rktio.rkt"
"../security/main.rkt")
(provide ->host
->host/as-is
host->)
host->
host-element->)
;; Note: `(host-> (->host x who flags))` is not the same as `x`, since
;; it normalizes `x`. That's why `(host-> (->host x))` is generally
@ -31,3 +33,9 @@
(define (host-> s)
(path (bytes->immutable-bytes s)
(system-path-convention-type)))
(define (host-element-> s)
(if (eq? 'windows (system-path-convention-type))
(path (protect-path-element (bytes->immutable-bytes s) 'windows)
'windows)
(host-> s)))

View File

@ -146,7 +146,7 @@
[else
(rktio_free fnp)
(end-atomic)
(loop (cons (host-> fn) accum))]))])))))
(loop (cons (host-element-> fn) accum))]))])))))
(define/who (delete-file p)
(check who path-string? p)