]> gitweb.factorcode.org Git - factor.git/commitdiff
alien.libraries.finder.macosx: check file exists and shared cache.
authorJohn Benediktsson <mrjbq7@gmail.com>
Sun, 14 Mar 2021 19:23:56 +0000 (12:23 -0700)
committerJohn Benediktsson <mrjbq7@gmail.com>
Sun, 14 Mar 2021 19:23:56 +0000 (12:23 -0700)
basis/alien/libraries/finder/macosx/macosx.factor

index 1f438dab170f36fe2fa5aff7f302c329851bf4af..795539f455443bd72b6196fca54b353ed8678e1f 100644 (file)
@@ -2,9 +2,9 @@
 ! See http://factorcode.org/license.txt for BSD license
 
 USING: accessors alien.c-types alien.libraries.finder
-alien.syntax arrays assocs combinators.short-circuit environment
-io.files io.files.info io.pathnames kernel locals make
-math.order namespaces sequences splitting system system-info ;
+alien.syntax arrays assocs combinators environment io.files
+io.files.info io.pathnames kernel make math.order namespaces
+sequences splitting system system-info ;
 
 IN: alien.libraries.finder.macosx
 
@@ -114,15 +114,19 @@ SYMBOL: dyld-executable-path
 
 FUNCTION: bool _dyld_shared_cache_contains_path ( c-string name )
 
+: use-dyld-shared-cache? ( -- ? )
+    os-version { 11 0 0 } after=? ;
+
 PRIVATE>
 
 : dyld-find ( name -- path/f )
-    dyld-search-paths
-    os-version { 11 0 0 } after=? [
-        [ _dyld_shared_cache_contains_path ] find
-    ] [
-        [ { [ exists? ] [ file-info regular-file? ] } 1&& ] find
-    ] if [ nip ] when* ;
+    dyld-search-paths [
+        {
+            { [ dup exists? ] [ file-info regular-file? ] }
+            { [ use-dyld-shared-cache? ] [ _dyld_shared_cache_contains_path ] }
+            [ drop f ]
+        } cond
+    ] find [ nip ] when* ;
 
 : framework-find ( name -- path )
     dup dyld-find [ nip ] [