Keep the find-library-file behavior in M\ windows find-library*.
! Copyright (C) 2013 Björn Lindqvist, John Benediktsson
! See http://factorcode.org/license.txt for BSD license
-USING: alien.libraries.finder arrays combinators.short-circuit
-environment io.backend io.files io.files.info io.pathnames kernel
-sequences splitting system system-info.windows ;
+USING: alien.data alien.libraries.finder alien.strings arrays
+byte-arrays combinators.short-circuit environment io.backend
+io.files io.files.info io.pathnames kernel sequences
+specialized-arrays splitting system system-info.windows
+windows.kernel32 windows.types ;
+FROM: alien.c-types => ushort ;
+SPECIALIZED-ARRAY: ushort
IN: alien.libraries.finder.windows
] with map concat
] if ;
-PRIVATE>
-
-M: windows find-library*
+: find-library-paths ( name -- path/f )
candidate-paths [
{ [ exists? ] [ file-info regular-file? ] } 1&&
] find nip ;
+
+: find-library-file ( name -- path/f )
+ f DONT_RESOLVE_DLL_REFERENCES LoadLibraryEx [
+ [
+ 32768 ushort (c-array) [ 32768 GetModuleFileName drop ] keep
+ alien>native-string
+ ] [ FreeLibrary drop ] bi
+ ] [ f ] if* ;
+
+PRIVATE>
+
+M: windows find-library*
+ { [ find-library-paths ] [ find-library-file ] } 1|| ;
+++ /dev/null
-! Copyright (C) 2010 Joe Groff.
-! See http://factorcode.org/license.txt for BSD license.
-USING: alien.libraries io.pathnames io.pathnames.private kernel
-system vocabs ;
-IN: tools.deploy.libraries
-
-HOOK: find-library-file os ( file -- path )
-
-os windows?
-"tools.deploy.libraries.windows"
-"tools.deploy.libraries.unix" ? require
+++ /dev/null
-! Copyright (C) 2010 Joe Groff.
-! See http://factorcode.org/license.txt for BSD license.
-USING: io.files io.pathnames io.pathnames.private kernel
-sequences system tools.deploy.libraries ;
-IN: tools.deploy.libraries.unix
-
-! stupid hack. better ways to find the library name would be open the library,
-! note a symbol address found in the library, then call dladdr (or use
-
-<PRIVATE
-
-: ?exists ( path -- path/f )
- dup exists? [ drop f ] unless ; inline
-
-PRIVATE>
-
-M: unix find-library-file
- dup absolute-path? [ ?exists ] [
- { "/lib" "/usr/lib" "/usr/local/lib" "/opt/local/lib" "resource:" }
- [ prepend-path ?exists ] with map-find drop
- ] if ;
+++ /dev/null
-! Copyright (C) 2010 Joe Groff.
-! See http://factorcode.org/license.txt for BSD license.
-USING: alien.data alien.strings byte-arrays
-kernel specialized-arrays system tools.deploy.libraries
-windows.kernel32 windows.types ;
-FROM: alien.c-types => ushort ;
-SPECIALIZED-ARRAY: ushort
-IN: tools.deploy.libraries.windows
-
-M: windows find-library-file
- f DONT_RESOLVE_DLL_REFERENCES LoadLibraryEx [
- [
- 32768 ushort (c-array) [ 32768 GetModuleFileName drop ] keep
- alien>native-string
- ] [ FreeLibrary drop ] bi
- ] [ f ] if* ;