From e3a85115f5c39a0446f3027bc3749ae270ae8f3d Mon Sep 17 00:00:00 2001 From: Robby Findler Date: Thu, 13 Mar 2014 14:17:51 -0500 Subject: [PATCH] handle the case where the links file contains an absolute path also try to make fewer assumptions about the content of links files closes PR 14392 --- .../drracket/private/find-completions.rkt | 25 +++++++++++++------ 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/pkgs/drracket-pkgs/drracket/drracket/private/find-completions.rkt b/pkgs/drracket-pkgs/drracket/drracket/private/find-completions.rkt index 1eaa1215ff..e6462fc239 100644 --- a/pkgs/drracket-pkgs/drracket/drracket/private/find-completions.rkt +++ b/pkgs/drracket-pkgs/drracket/drracket/private/find-completions.rkt @@ -79,14 +79,23 @@ (cond [link (define-values (base name dir?) (split-path link)) - (if (file-exists? link) - (for/list ([link-ent (call-with-input-file link read)] - #:when (if (= 3 (length link-ent)) - (regexp-match (list-ref link-ent 2) (version)) - #t)) - `(,(list-ref link-ent 0) - ,(simplify-path (build-path base (list-ref link-ent 1))))) - '())] + (cond + [(file-exists? link) + (define link-ents (with-handlers ([exn:fail? (λ (x) '())]) + (call-with-input-file link read))) + (for/list ([link-ent (if (list? link-ents) + link-ents + '())] + #:when (if (and (list? link-ent) (= 3 (length link-ent))) + (and (regexp? (list-ref link-ent 2)) + (regexp-match (list-ref link-ent 2) (version))) + #t)) + `(,(list-ref link-ent 0) + ,(simplify-path + (if (relative-path? (list-ref link-ent 1)) + (build-path base (list-ref link-ent 1)) + (list-ref link-ent 1)))))] + [else '()])] [else (for/list ([clp (in-list library-collection-paths)]) `(root ,(simplify-path clp)))]))))