factor/basis/alien/libraries/finder/finder.factor

17 lines
590 B
Factor

USING: accessors kernel sequences system vocabs ;
IN: alien.libraries.finder
HOOK: find-library* os ( name -- path/f )
: find-library ( name -- path/library-not-found )
dup find-library* [ nip ] when* ;
! Try to find the library from a list, but if it's not found,
! try to open a library that is the first name in that list anyway
! or "library_not_found" as a last resort for better debugging.
: find-library-from-list ( seq -- path/f )
dup [ find-library* ] map-find drop
[ nip ] [ ?first "library_not_found" or ] if* ;
"alien.libraries.finder." os name>> append require