diff --git a/collects/mred/private/path-dialog.ss b/collects/mred/private/path-dialog.ss index 724a72ab12..8acd0839d6 100644 --- a/collects/mred/private/path-dialog.ss +++ b/collects/mred/private/path-dialog.ss @@ -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,