diff --git a/racket/src/io/file/host.rkt b/racket/src/io/file/host.rkt index da769968d5..cf80de5267 100644 --- a/racket/src/io/file/host.rkt +++ b/racket/src/io/file/host.rkt @@ -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))) diff --git a/racket/src/io/file/main.rkt b/racket/src/io/file/main.rkt index b630910a7a..58f78e4764 100644 --- a/racket/src/io/file/main.rkt +++ b/racket/src/io/file/main.rkt @@ -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)