File_Utilities module

how_much_of_path_exists_on_the_local_filesystem

procedure · 1 overloadSource

How many leading words of path exist: (fully_exists, how_much_exists). It checks a, then a/b, then a/b/c and so on, and stops at the first that is missing. The count is 0 when even the first is missing and the number of words when all of them exist. An empty path is (true, 0).

how_much_of_path_exists_on_the_local_filesystem :: (
    path: Paths.Path
) -> (fully_exists: bool, how_much_exists: s32)

Parameters

Returns

fully_exists: bool
how_much_exists: s32
ExampleOpen in playground ↗
path := parse_path("jai-doc-no-such-folder/inner/file");
defer array_free(path.words);
exists, count := how_much_of_path_exists_on_the_local_filesystem(path);
assert(!exists && count == 0);

See also