alien.libraries.finder.windows: more like MSDN search order.

db4
John Benediktsson 2013-11-16 16:09:53 -08:00
parent 45af0bc563
commit 302df73686
2 changed files with 22 additions and 11 deletions

View File

@ -0,0 +1 @@
windows

View File

@ -1,22 +1,32 @@
! Copyright (C) 2013 Björn Lindqvist ! Copyright (C) 2013 Björn Lindqvist, John Benediktsson
! See http://factorcode.org/license.txt for BSD license ! See http://factorcode.org/license.txt for BSD license
USING: alien.libraries alien.libraries.finder arrays combinators USING: alien.libraries.finder arrays combinators.short-circuit
kernel sequences system ; environment io.files io.files.info io.pathnames kernel sequences
splitting system system-info.windows ;
IN: alien.libraries.finder.windows IN: alien.libraries.finder.windows
<PRIVATE <PRIVATE
: candidate-paths ( name -- paths ) : search-paths ( -- seq )
{ "resource:" system-directory windows-directory 3array
[ ".dll" append ] "PATH" os-env [ ";" split ] [ f ] if* append ;
[ "lib" ".dll" surround ]
[ "dlls/" ".dll" surround ] : candidate-paths ( name -- seq )
[ "dlls/lib" ".dll" surround ] search-paths over ".dll" tail? [
} cleave 4array ; [ prepend-path ] with map
] [
[
[ prepend-path ]
[ [ ".dll" append ] [ prepend-path ] bi* ] 2bi
2array
] with map concat
] if ;
PRIVATE> PRIVATE>
M: windows find-library M: windows find-library
candidate-paths [ dlopen dll-valid? ] map-find nip ; candidate-paths [
{ [ exists? ] [ file-info regular-file? ] } 1&&
] map-find nip ;