use bytes->string/locale to translate paths-as-bytes to strings

svn: r5318
This commit is contained in:
Eli Barzilay 2007-01-12 00:52:23 +00:00
parent 2589d4fc0d
commit 89ce220ed9
2 changed files with 4 additions and 7 deletions

View File

@ -4,12 +4,9 @@
(let* ([p (syntax-source stx)] (let* ([p (syntax-source stx)]
[dir (and (path? p) (let-values ([(b _1 _2) (split-path p)]) b))] [dir (and (path? p) (let-values ([(b _1 _2) (split-path p)]) b))]
[name (and (path? dir) [name (and (path? dir)
;; path->string + bytes->path is a hack to get a proper (bytes->string/locale
;; string because there is no path-element->string
(path->string
(bytes->path
(path-element->bytes (path-element->bytes
(let-values ([(_1 p _2) (split-path dir)]) p)))))]) (let-values ([(_1 p _2) (split-path dir)]) p))))])
;; check that we are installed as a top-level collection (this is needed ;; check that we are installed as a top-level collection (this is needed
;; because there are some code bits (that depend on bindings from this ;; because there are some code bits (that depend on bindings from this
;; file) that expect this to be true) ;; file) that expect this to be true)

View File

@ -51,7 +51,7 @@
(define (path->pname path isdir?) (define (path->pname path isdir?)
(let* ([name (if (member (path->string path) '("." "..")) (let* ([name (if (member (path->string path) '("." ".."))
(path->string path) ; avoid segfault bug (PR8481) (path->string path) ; avoid segfault bug (PR8481)
(bytes->string/utf-8 (path-element->bytes path)))] (bytes->string/locale (path-element->bytes path)))]
[name (regexp-replace end-separators-rx name "")] [name (regexp-replace end-separators-rx name "")]
[name (if (<= 199 (string-length name)) [name (if (<= 199 (string-length name))
(string-append (substring name 0 195) "...") (string-append (substring name 0 195) "...")