From 51cfd499fcd900f240e0055710cb8f81e62c0e3f Mon Sep 17 00:00:00 2001 From: Eli Barzilay Date: Wed, 10 Jan 2007 10:33:54 +0000 Subject: [PATCH] fix PR8428, and also paths with an initial "~" svn: r5294 original commit: 5876ed8e3b76452a6cefd9266e508077256df4c2 --- collects/mred/private/path-dialog.ss | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/collects/mred/private/path-dialog.ss b/collects/mred/private/path-dialog.ss index 724a72ab..8acd0839 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,