hare

The Hare programming language
git clone https://git.torresjrjr.com/hare.git
Log | Files | Refs | README | LICENSE

commit 8099b144cbbccd960ecfe48a74f5ca297b5c01b8
parent c675cef368fd1bddf43857f69477d661be0ccaf1
Author: Yasumasa Tada <ytada@spartan.dev>
Date:   Sat,  9 Apr 2022 20:44:57 +0900

glob: handle a leading period correctly

Signed-off-by: Yasumasa Tada <ytada@spartan.dev>

Diffstat:
Mglob/glob.ha | 3++-
1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/glob/glob.ha b/glob/glob.ha @@ -95,12 +95,13 @@ fn next_match(fs: *fs::fs, gen: *generator) (const str | void | fs::error) = { rem = strings::sub(p, ends.1, strings::end); }; + let flgs = fnmatch::flags::PERIOD; let it = fs::iter(fs, if (len(dir) > 0) dir else ".")?; for (true) match (fs::next(it)) { case void => break; case let de: fs::dirent => - if (!fnmatch::fnmatch(pat, de.name)) { + if (!fnmatch::fnmatch(pat, de.name, flgs)) { continue; }; if (len(rem) == 0) {