]> gitweb.factorcode.org Git - factor.git/commit
io.pathnames: Allow vocab: to find paths that do not exist as long as the vocab exists.
authorDoug Coleman <doug.coleman@gmail.com>
Thu, 6 Jan 2022 05:21:02 +0000 (23:21 -0600)
committerDoug Coleman <doug.coleman@gmail.com>
Thu, 6 Jan 2022 05:30:06 +0000 (23:30 -0600)
commit10da22ab30080f7136d18ec2f526588b753ad035
tree28a3a42b4ff036f72efa51843ae80212cf5fd18a
parentd559f46253366e085df07b4c43e085890e057080
io.pathnames: Allow vocab: to find paths that do not exist as long as the vocab exists.

`"benchmark/sum-file/sum-file.txt" vocab-path` can now reference a file
in a vocab.

Add `has-path-extension?` word which ensures a path is not a
directory (does not end in / or any path-separator), and if
that's the case then it is true if there's a dot in the file name.

The cases we check in vocab-path (triggered with vocab:)
- if path ends in /, we assume it must be a vocab that exists
-- you can't create a vocab that doesn't exist with vocab:foo syntax
because there the root is ambiguous

- if path has extension, we assume it's a file name and allow it
to look up if the parent vocabulary exists

- finally we just try the current behavior, e.g. the vocab has
to exist

Added a lot of tests, please file bugs if you disagree!

Fixes #592.
core/io/pathnames/pathnames-tests.factor
core/io/pathnames/pathnames.factor
core/vocabs/loader/loader.factor