From: Doug Coleman Date: Thu, 6 Jan 2022 16:24:51 +0000 (-0600) Subject: vocabs.loader: fix vocab:path to use an existing path X-Git-Tag: 0.99~1944 X-Git-Url: https://gitweb.factorcode.org/gitweb.cgi?p=factor.git;a=commitdiff_plain;h=ba2f27902f8eed848bac927d471915efc4e3e013 vocabs.loader: fix vocab:path to use an existing path This particular path would have been found in core/ if it did not exist in basis/ already. Fixes bootstrap --- diff --git a/core/io/pathnames/pathnames-tests.factor b/core/io/pathnames/pathnames-tests.factor index b21de3050b..b821f6fbba 100644 --- a/core/io/pathnames/pathnames-tests.factor +++ b/core/io/pathnames/pathnames-tests.factor @@ -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 diff --git a/core/vocabs/loader/loader.factor b/core/vocabs/loader/loader.factor index a9e6fde666..d413a46e71 100644 --- a/core/vocabs/loader/loader.factor +++ b/core/vocabs/loader/loader.factor @@ -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>