From dce7a033bd98cd8feebd1872392bc9d8fd65db19 Mon Sep 17 00:00:00 2001 From: John Clements Date: Tue, 18 Sep 2007 18:29:37 +0000 Subject: [PATCH] installed-tools for-directory should return null on a nonexistent directory svn: r7382 --- collects/drscheme/private/tools.ss | 57 +++++++++++++++--------------- 1 file changed, 29 insertions(+), 28 deletions(-) diff --git a/collects/drscheme/private/tools.ss b/collects/drscheme/private/tools.ss index d02b88846a..0207a94036 100644 --- a/collects/drscheme/private/tools.ss +++ b/collects/drscheme/private/tools.ss @@ -78,34 +78,35 @@ ;; installed-tools-for-directory : directory-record -> (list-of installed-tool) (define (installed-tools-for-directory coll-dir) (let ([table (get-info/full (directory-record-path coll-dir))]) - (when table - (let* ([tools (table 'tools (lambda () null))] - [tool-icons (table 'tool-icons (lambda () (map (lambda (x) #f) tools)))] - [tool-names (table 'tool-names (lambda () (map (lambda (x) #f) tools)))] - [tool-urls (table 'tool-urls (lambda () (map (lambda (x) #f) tools)))]) - (unless (= (length tools) (length tool-icons)) - (message-box (string-constant drscheme) - (format (string-constant tool-tool-icons-same-length) - coll-dir tools tool-icons) - #f - '(ok stop)) - (set! tool-icons (map (lambda (x) #f) tools))) - (unless (= (length tools) (length tool-names)) - (message-box (string-constant drscheme) - (format (string-constant tool-tool-names-same-length) - coll-dir tools tool-names) - #f - '(ok stop)) - (set! tool-names (map (lambda (x) #f) tools))) - (unless (= (length tools) (length tool-urls)) - (message-box (string-constant drscheme) - (format (string-constant tool-tool-urls-same-length) - coll-dir tools tool-urls) - #f - '(ok stop)) - (set! tool-urls (map (lambda (x) #f) tools))) - (map (lambda (t i n u) (make-installed-tool coll-dir t i n u)) - tools tool-icons tool-names tool-urls))))) + (if table + (let* ([tools (table 'tools (lambda () null))] + [tool-icons (table 'tool-icons (lambda () (map (lambda (x) #f) tools)))] + [tool-names (table 'tool-names (lambda () (map (lambda (x) #f) tools)))] + [tool-urls (table 'tool-urls (lambda () (map (lambda (x) #f) tools)))]) + (unless (= (length tools) (length tool-icons)) + (message-box (string-constant drscheme) + (format (string-constant tool-tool-icons-same-length) + coll-dir tools tool-icons) + #f + '(ok stop)) + (set! tool-icons (map (lambda (x) #f) tools))) + (unless (= (length tools) (length tool-names)) + (message-box (string-constant drscheme) + (format (string-constant tool-tool-names-same-length) + coll-dir tools tool-names) + #f + '(ok stop)) + (set! tool-names (map (lambda (x) #f) tools))) + (unless (= (length tools) (length tool-urls)) + (message-box (string-constant drscheme) + (format (string-constant tool-tool-urls-same-length) + coll-dir tools tool-urls) + #f + '(ok stop)) + (set! tool-urls (map (lambda (x) #f) tools))) + (map (lambda (t i n u) (make-installed-tool coll-dir t i n u)) + tools tool-icons tool-names tool-urls)) + null))) ;; candidate-tool? : installed-tool -> boolean ;; Predicate for tools selected for execution in this