From a228fa6527671ee8a2330b6c6535d987701db73a Mon Sep 17 00:00:00 2001 From: Robby Findler Date: Mon, 26 Apr 2010 20:49:13 -0500 Subject: [PATCH] made get-info/full work with info.rkt files --- .../scribblings/setup-plt/setup-plt.scrbl | 25 ++++++++++++------- collects/setup/getinfo.ss | 6 ++++- 2 files changed, 21 insertions(+), 10 deletions(-) diff --git a/collects/scribblings/setup-plt/setup-plt.scrbl b/collects/scribblings/setup-plt/setup-plt.scrbl index 4bb2725cb3..cc17bc043d 100644 --- a/collects/scribblings/setup-plt/setup-plt.scrbl +++ b/collects/scribblings/setup-plt/setup-plt.scrbl @@ -1174,14 +1174,10 @@ An @deftech{unpackable} is one of the following: (symbol? [(-> any)] . -> . any) false/c)]{ - Accepts a path to a directory. It returns @scheme[#f] if there is - no @filepath{info.ss} file in the directory. If the - @filepath{info.ss} file has the wrong shape (i.e., not a module - using @schememodname[setup/infotab] or @scheme[(lib "infotab.ss" "setup")]), - or if the @filepath{info.ss} file fails to load, then an exception - is raised. - - Otherwise, @scheme[get-info/full] returns an info procedure of one + Accepts a path to a directory. If it finds either a well-formed + an @filepath{info.rkt} file or an @filepath{info.ss} file (with + preference for the @filepath{info.rkt} file), + it returns an info procedure that accepts either one or two arguments. The first argument to the info procedure is always a symbolic name, and the result is the value of the name in the @filepath{info.ss} file, if the name is defined. The optional @@ -1189,7 +1185,18 @@ An @deftech{unpackable} is one of the following: arguments to be called when the name is not defined; the result of the info procedure is the result of the @scheme[_thunk] in that case. If the name is not defined and no @scheme[_thunk] is - provided, then an exception is raised.} + provided, then an exception is raised. + + @scheme[get-info/full] returns @scheme[#f] if there is + no @filepath{info.rkt} or @filepath{info.ss} file in the directory. If there is a + @filepath{info.rkt} file that has the wrong shape (i.e., not a module + using @schememodname[setup/infotab] or @scheme[(lib "infotab.ss" "setup")]), + or if the @filepath{info.rkt} file fails to load, then an exception + is raised. If the @filepath{info.rkt} file loaded, @scheme[get-info/full] + returns the @scheme[get-info] file. If the @filepath{info.rkt} file does not exist, + then @scheme[get-info/full] does + the same checks for the @filepath{info.ss} file, either raising an exception + or returning the @scheme[get-info] function from the @filepath{info.ss} file.} @defproc[(find-relevant-directories (syms (listof symbol?)) diff --git a/collects/setup/getinfo.ss b/collects/setup/getinfo.ss index 87cd94b208..e743b4535c 100644 --- a/collects/setup/getinfo.ss +++ b/collects/setup/getinfo.ss @@ -25,7 +25,11 @@ ;; get-info/full : path -> info/#f (define (get-info/full dir) - (define file (build-path dir "info.ss")) + (or (get-info/full/ext dir "rkt") + (get-info/full/ext dir "ss"))) + +(define (get-info/full/ext dir ext) + (define file (build-path dir (format "info.~a" ext))) (define (err fmt . args) (apply error 'get-info (string-append "info file " fmt " in ~a") (append args (list file))))