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


7.8.4 Scanning the compiled libraries path

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

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

Hold a function used to convert a R6RS library reference into the corresponding compiled library file pathname in the search path specified by the parameter library-binary-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 FASL file pathname; a thunk to be called to continue the search from the next directory in the search path. When no matching library is found: it must return #f and #f.

This parameter can be used as follows:

(define scanner
  (current-library-binary-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-binary-search-path-scanner libref

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

Return two values. When successful: a string representing the file pathname; a thunk to be called to continue the search from the next directory in the search path. When no matching library is found: 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 binary file with version number included: we must set the parameter current-library-binary-search-path-scanner to a different function.