feat: add missing parts
diff --git a/src/Std/FS/Types.lean b/src/Std/FS/Types.lean index 01c0c43..fcc0531 100644 --- a/src/Std/FS/Types.lean +++ b/src/Std/FS/Types.lean
@@ -83,6 +83,13 @@ opaque ofMode (mode : UInt64) : FileType /-- +Read the entry kind out of the raw type code reported by a directory read. Codes the platform does +not report a kind for translate to `unknown`. +-/ +@[extern "lean_uv_fs_file_type_of_dirent"] +opaque ofDirentType (type : UInt8) : FileType + +/-- Whether this is a regular file. -/ def isFile (type : FileType) : Bool :=
diff --git a/src/Std/Path/Basic.lean b/src/Std/Path/Basic.lean index 43ed84a..b967fe3 100644 --- a/src/Std/Path/Basic.lean +++ b/src/Std/Path/Basic.lean
@@ -645,6 +645,18 @@ hDiv p name := p.join (ofFilename name) /-- +Test `p` against an already-parsed glob pattern. See `matchGlob` for the pattern syntax and the +meaning of `matchDrivePrefix`; parsing once and matching many paths against the result avoids +reparsing the pattern for each of them. +-/ +def matchParsedGlob (p : Path) (glob : Internal.Glob) (matchDrivePrefix : Bool := false) : Bool := + let comps := p.components.filter fun + | .winPrefix _ => matchDrivePrefix + | _ => true + + Internal.matchSegments glob comps 0 0 + +/-- Test `p` against a glob pattern. The pattern always uses `/` to separate segments, regardless of platform. By default, Windows @@ -665,12 +677,7 @@ def matchGlob (p : Path) (pattern : String) (matchDrivePrefix : Bool := false) : Bool := match Internal.parseGlob pattern with | none => false - | some glob => - let comps := p.components.filter fun - | .winPrefix _ => matchDrivePrefix - | _ => true - - Internal.matchSegments glob comps 0 0 + | some glob => p.matchParsedGlob glob matchDrivePrefix /-- Parse a POSIX-formatted string into a `Path`. Pure; uses `/` as the only separator.