2016-03-29 02:04:19 -04:00
|
|
|
USING: accessors alien.libraries kernel sequences system vocabs
|
|
|
|
;
|
2013-11-16 14:58:37 -05:00
|
|
|
IN: alien.libraries.finder
|
2013-11-07 18:30:23 -05:00
|
|
|
|
2014-06-07 23:48:09 -04:00
|
|
|
HOOK: find-library* os ( name -- path/f )
|
|
|
|
|
|
|
|
: find-library ( name -- path/library-not-found )
|
|
|
|
dup find-library* [ nip ] when* ;
|
2014-07-08 13:40:33 -04:00
|
|
|
|
2016-03-29 10:35:45 -04:00
|
|
|
: ?update-library ( name path abi -- )
|
2016-03-29 02:04:19 -04:00
|
|
|
pick lookup-library [ dll>> dll-valid? ] [ f ] if* [
|
|
|
|
3drop
|
|
|
|
] [
|
2016-03-29 10:35:45 -04:00
|
|
|
[ find-library ] [ update-library ] bi*
|
2016-03-29 02:04:19 -04:00
|
|
|
] if ;
|
|
|
|
|
2014-07-08 13:40:33 -04:00
|
|
|
! 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
|
2015-07-18 23:14:22 -04:00
|
|
|
! or "library_not_found" as a last resort for better debugging.
|
2014-07-08 13:21:50 -04:00
|
|
|
: find-library-from-list ( seq -- path/f )
|
2014-07-08 14:58:34 -04:00
|
|
|
dup [ find-library* ] map-find drop
|
2016-07-11 22:50:37 -04:00
|
|
|
[ ] [ ?first "library_not_found" or ] ?if ;
|
2013-11-04 11:28:45 -05:00
|
|
|
|
2014-11-13 16:00:44 -05:00
|
|
|
"alien.libraries.finder." os name>> append require
|