From 57524d3b8c2e9d89a63c62bf0d46753b369079ec Mon Sep 17 00:00:00 2001 From: Robby Findler Date: Thu, 14 Dec 2006 00:17:54 +0000 Subject: [PATCH] fixed a bug in help desk resetting of the cache svn: r5112 --- collects/help/private/search.ss | 3 +++ collects/setup/doc.txt | 4 ++++ collects/setup/getinfo.ss | 37 +++++++++++++++++++-------------- 3 files changed, 28 insertions(+), 16 deletions(-) diff --git a/collects/help/private/search.ss b/collects/help/private/search.ss index 8ca3bd518a..98d61925cd 100644 --- a/collects/help/private/search.ss +++ b/collects/help/private/search.ss @@ -3,6 +3,7 @@ "colldocs.ss" "path.ss" "manuals.ss" + (lib "getinfo.ss" "setup") (lib "list.ss") (lib "plt-match.ss") (lib "contract.ss") @@ -287,6 +288,8 @@ (string->list s))))) (define (doc-collections-changed) + (reset-relevant-directories-state!) + (reset-doc-lists) (set! doc-collection-dates (map (lambda (x) #f) doc-dirs)) (set! html-keywords (make-hash-table 'equal)) (set! html-indices (make-hash-table 'equal)) diff --git a/collects/setup/doc.txt b/collects/setup/doc.txt index a5eec68c93..8a080cf9e0 100644 --- a/collects/setup/doc.txt +++ b/collects/setup/doc.txt @@ -435,6 +435,10 @@ The _getinfo.ss_ module defines the following procedures: same name, find-relevant-directories will only search the one that occurs first in the PLT_COLLECTION_PATHS environment variable. +> (reset-relevant-directories-state!) + + Resets the cache used by `find-relevant-directories'. + _.plt_ Archive Internals ========================================================== diff --git a/collects/setup/getinfo.ss b/collects/setup/getinfo.ss index 5a43782ce6..d26042dd34 100644 --- a/collects/setup/getinfo.ss +++ b/collects/setup/getinfo.ss @@ -50,23 +50,27 @@ paths ; listof path )) - (define preferred-table - (make-table - (lambda (i l) - (cond - [(null? l) - (list i)] - [else - (match-let ([(_ _ my-maj my-min) i] - [(_ _ their-maj their-min) (car l)]) - (if - (or (> my-maj their-maj) - (and (= my-maj their-maj) (>= my-min their-min))) - (list i) - l))])) - #f #f)) + (define preferred-table #f) + (define all-available-table #f) - (define all-available-table (make-table cons #f #f)) + (define (reset-relevant-directories-state!) + (set! preferred-table + (make-table + (lambda (i l) + (cond + [(null? l) + (list i)] + [else + (match-let ([(_ _ my-maj my-min) i] + [(_ _ their-maj their-min) (car l)]) + (if + (or (> my-maj their-maj) + (and (= my-maj their-maj) (>= my-min their-min))) + (list i) + l))])) + #f #f)) + (set! all-available-table (make-table cons #f #f))) + (reset-relevant-directories-state!) (define (populate-table! t) ;; Use the colls ht because a collection might be in multiple @@ -175,6 +179,7 @@ [else (path->bytes name)]))) (provide/contract + (reset-relevant-directories-state! (-> any)) (get-info ((listof path-or-string?) . -> . (or/c info? boolean?))) (get-info/full (path? . -> . (or/c info? boolean?))) (find-relevant-directories (opt-> ((listof symbol?))