Next: , Previous: , Up: libutils file-system   [Index]


7.8.5 Scanning the source libraries path

The following bindings are exported by the library (vicare libraries).

Parameter: current-library-source-search-path-scanner

Hold a function used to convert a R6RS library reference into the corresponding source library file pathname in the search path specified by the parameter library-source-search-path.

The referenced function must accept, as single value, a R6RS library reference and it must return two values. When successful: a string representing the source file pathname; a thunk to be called to continue the search from the next directory in the search path. Otherwise it must return #f and #f.

This parameter can be used as follows:

(define scanner
  (current-library-source-search-path-scanner))

(let loop ((next-file-match (lambda ()
                              (scanner libref))))
  (receive (pathname further-file-match)
      (next-file-match)
    (if pathname
        (if (valid-library? pathname)
            (use-the-library pathname)
          (loop further-file-match))
      (search-failed))))
Function: default-library-source-search-path-scanner libref

Default value for the parameter current-library-source-search-path-scanner. Given a R6RS library reference: scan the source library search path for the corresponding file.

Return two values. When successful: a string representing the source file pathname; a thunk to be called to continue the search from the next directory in the search path. Otherwise it must return #f and #f.

The file pathname is built using the stem returned by library-reference->filename-stem. Notice that the file pathnames built by this function have no version number embedded in the pathname; if we want to search for a source file with version number included: we must set the parameter current-library-source-search-path-scanner to a different function.