2013-11-16 19:09:53 -05:00
|
|
|
! Copyright (C) 2013 Björn Lindqvist, John Benediktsson
|
2013-11-16 14:58:37 -05:00
|
|
|
! See http://factorcode.org/license.txt for BSD license
|
|
|
|
|
2013-11-16 19:09:53 -05:00
|
|
|
USING: alien.libraries.finder arrays combinators.short-circuit
|
2014-07-08 02:34:10 -04:00
|
|
|
environment io.backend io.files io.files.info io.pathnames kernel
|
|
|
|
sequences splitting system system-info.windows ;
|
2013-11-16 14:58:37 -05:00
|
|
|
|
|
|
|
IN: alien.libraries.finder.windows
|
|
|
|
|
|
|
|
<PRIVATE
|
|
|
|
|
2013-11-16 19:09:53 -05:00
|
|
|
: search-paths ( -- seq )
|
2014-07-08 02:34:10 -04:00
|
|
|
"resource:" normalize-path
|
|
|
|
system-directory
|
|
|
|
windows-directory 3array
|
2013-11-16 19:09:53 -05:00
|
|
|
"PATH" os-env [ ";" split ] [ f ] if* append ;
|
|
|
|
|
|
|
|
: candidate-paths ( name -- seq )
|
|
|
|
search-paths over ".dll" tail? [
|
|
|
|
[ prepend-path ] with map
|
|
|
|
] [
|
|
|
|
[
|
|
|
|
[ prepend-path ]
|
|
|
|
[ [ ".dll" append ] [ prepend-path ] bi* ] 2bi
|
|
|
|
2array
|
|
|
|
] with map concat
|
|
|
|
] if ;
|
2013-11-16 14:58:37 -05:00
|
|
|
|
|
|
|
PRIVATE>
|
|
|
|
|
2014-06-07 23:48:09 -04:00
|
|
|
M: windows find-library*
|
2013-11-16 19:09:53 -05:00
|
|
|
candidate-paths [
|
|
|
|
{ [ exists? ] [ file-info regular-file? ] } 1&&
|
|
|
|
] map-find nip ;
|