]> gitweb.factorcode.org Git - factor.git/commitdiff
vocabs.loader: fix vocab:path to use an existing path
authorDoug Coleman <doug.coleman@gmail.com>
Thu, 6 Jan 2022 16:24:51 +0000 (10:24 -0600)
committerDoug Coleman <doug.coleman@gmail.com>
Thu, 6 Jan 2022 16:24:51 +0000 (10:24 -0600)
This particular path would have been found in core/ if it did
not exist in basis/ already.

Fixes bootstrap

core/io/pathnames/pathnames-tests.factor
core/vocabs/loader/loader.factor

index b21de3050be03d6bf1edc7556220ac915e970711..b821f6fbba180c5c4c340733ea05eff1665664b1 100644 (file)
@@ -184,4 +184,8 @@ os windows? [
 [ "benchmark/sum-file" vocab-path ] unit-test
 
 { "resource:extra/benchmark/sum-file/" }
-[ "benchmark/sum-file/" vocab-path ] unit-test
\ No newline at end of file
+[ "benchmark/sum-file/" vocab-path ] unit-test
+
+! Would be a core/ path except the path already exists in basis
+{ "resource:basis/bootstrap/finish-bootstrap.factor" }
+[ "bootstrap/finish-bootstrap.factor" vocab-path ] unit-test
\ No newline at end of file
index a9e6fde666efba65e7c5b610be2e4b8f909a6a75..d413a46e716aec656cd24295a81f3454e3d48498 100644 (file)
@@ -44,15 +44,20 @@ ERROR: not-found-in-roots path ;
     [ drop not-found-in-roots ]
     [ nip ] if ;
 
+! If path exists use it, otherwise try to find a vocab that exists
 M: string vocab-path
-    {
-        { [ dup ?last path-separator? ] [ find-root-for-vocab-pathname ] }
-        { [ dup has-file-extension? ] [
-            [ ensure-parent-directory-is-not-dot find-root-for-vocab-pathname ]
-            [ file-name ] bi append-path
-        ] }
-        [ find-root-for-vocab-pathname ]
-    } cond ;
+    dup find-root-for [
+        prepend-path
+    ] [
+        {
+            { [ dup ?last path-separator? ] [ find-root-for-vocab-pathname ] }
+            { [ dup has-file-extension? ] [
+                [ ensure-parent-directory-is-not-dot find-root-for-vocab-pathname ]
+                [ file-name ] bi append-path
+            ] }
+            [ find-root-for-vocab-pathname ]
+        } cond
+    ] if* ;
 
 PRIVATE>