]> gitweb.factorcode.org Git - factor.git/blob - basis/alien/libraries/finder/windows/windows.factor
Merge branch 'master' of factorcode.org:/git/factor
[factor.git] / basis / alien / libraries / finder / windows / windows.factor
1 ! Copyright (C) 2013 Björn Lindqvist, John Benediktsson
2 ! See http://factorcode.org/license.txt for BSD license
3
4 USING: alien.libraries.finder arrays combinators.short-circuit
5 environment io.backend io.files io.files.info io.pathnames kernel
6 sequences splitting system system-info.windows ;
7
8 IN: alien.libraries.finder.windows
9
10 <PRIVATE
11
12 : search-paths ( -- seq )
13     "resource:" normalize-path
14     system-directory
15     windows-directory 3array
16     "PATH" os-env [ ";" split ] [ f ] if* append ;
17
18 : candidate-paths ( name -- seq )
19     search-paths over ".dll" tail? [
20         [ prepend-path ] with map
21     ] [
22         [
23             [ prepend-path ]
24             [ [ ".dll" append ] [ prepend-path ] bi* ] 2bi
25             2array
26         ] with map concat
27     ] if ;
28
29 PRIVATE>
30
31 M: windows find-library*
32     candidate-paths [
33         { [ exists? ] [ file-info regular-file? ] } 1&&
34     ] map-find nip ;