fix PR8428, and also paths with an initial "~"

svn: r5294

original commit: 5876ed8e3b76452a6cefd9266e508077256df4c2
This commit is contained in:
Eli Barzilay 2007-01-10 10:33:54 +00:00
parent ec9ae05b52
commit 51cfd499fc

View File

@ -49,7 +49,13 @@
(define-struct pname (path string isdir? okstring? nulstring))
(define (path->pname path isdir?)
(let* ([name (regexp-replace end-separators-rx (path->string path) "")]
(let* ([name (if (member (path->string path) '("." ".."))
(path->string path) ; avoid segfault bug (PR8481)
(bytes->string/utf-8 (path-element->bytes path)))]
[name (regexp-replace end-separators-rx name "")]
[name (if (<= 199 (string-length name))
(string-append (substring name 0 195) "...")
name)]
[name/ (if isdir? (string-append name path-separator) name)]
[goodstr? (equal? path (string->path name))]
[no-globs? (not (regexp-match-positions isfilter-rx name))])
@ -58,6 +64,10 @@
;; * paths where the string name does not correspond to the
;; path, eg, a sequence of bytes that interprets badly when
;; using UTF-8
;; * paths that are about 200 characters or longer (the
;; displayed name must be truncated) (part of the above)
;; * paths that have an initial "~" in them (also part of the
;; above)
;; * paths that contain `*' and `?', since they will be
;; considered as filters
;; in these cases, the string is shown in the path-list gui,