]> gitweb.factorcode.org Git - factor.git/blob - basis/alien/libraries/finder/finder.factor
factor: use ??if instead of ?if-old
[factor.git] / basis / alien / libraries / finder / finder.factor
1 USING: accessors alien.libraries kernel sequences system vocabs
2 ;
3 IN: alien.libraries.finder
4
5 HOOK: find-library* os ( name -- path/f )
6
7 : find-library ( name -- path/library-not-found )
8     dup find-library* [ nip ] when* ;
9
10 : ?update-library ( name path abi -- )
11     pick lookup-library [ dll>> dll-valid? ] [ f ] if* [
12         3drop
13     ] [
14         [ find-library ] [ update-library ] bi*
15     ] if ;
16
17 ! Try to find the library from a list, but if it's not found,
18 ! try to open a library that is the first name in that list anyway
19 ! or "library_not_found" as a last resort for better debugging.
20 : find-library-from-list ( seq -- path/f )
21     [ [ find-library* ] map-find drop ]
22     [ ?first "library_not_found" or ] ?unless ;
23
24 "alien.libraries.finder." os name>> append require