Equations
- System.instHashableFilePath = { hash := [anonymous] }
Equations
- System.instInhabitedFilePath = { default := { toString := default } }
Equations
Equations
- System.instReprFilePath = { reprPrec := fun p => Repr.addAppParen (Std.Format.text "FilePath.mk " ++ repr p.toString) }
Equations
- System.instToStringFilePath = { toString := fun p => p.toString }
Equations
- System.FilePath.pathSeparator = if System.Platform.isWindows = true then Char.ofNat 92 else Char.ofNat 47
Equations
- System.FilePath.pathSeparators = if System.Platform.isWindows = true then [Char.ofNat 92, Char.ofNat 47] else [Char.ofNat 47]
Equations
Equations
- System.FilePath.exeExtension = if System.Platform.isWindows = true then "exe" else ""
def
System.FilePath.normalize
(p : System.FilePath)
(normalizeCase : optParam Bool System.FilePath.isCaseInsensitive)
:
Equations
- System.FilePath.normalize p normalizeCase = if (List.length System.FilePath.pathSeparators == 1 && !normalizeCase) = true then p else { toString := String.map (fun c => if List.contains System.FilePath.pathSeparators c = true then System.FilePath.pathSeparator else if normalizeCase = true then Char.toLower c else c) p.toString }
Equations
- System.FilePath.isAbsolute p = (List.contains System.FilePath.pathSeparators (String.front p.toString) || System.Platform.isWindows && decide (String.bsize p.toString ≥ 1) && String.getOp p.toString 1 == Char.ofNat 58)
Equations
Equations
- System.FilePath.join p sub = if System.FilePath.isAbsolute sub = true then sub else { toString := p.toString ++ Char.toString System.FilePath.pathSeparator ++ sub.toString }
Equations
- System.FilePath.instDivFilePath = { div := System.FilePath.join }
Equations
- System.FilePath.instHDivFilePathString = { hDiv := fun p sub => System.FilePath.join p { toString := sub } }
Equations
- System.FilePath.parent p = System.FilePath.mk <$> String.extract p.toString 0 <$> System.FilePath.posOfLastSep p
Equations
- System.FilePath.fileName p = let lastPart := match System.FilePath.posOfLastSep p with | some sepPos => String.extract p.toString (sepPos + 1) (String.bsize p.toString) | none => p.toString; if (String.isEmpty lastPart || lastPart == "." || lastPart == "..") = true then none else some lastPart
Equations
- System.FilePath.fileStem p = Option.map (fun fname => match String.revPosOf fname (Char.ofNat 46) with | some 0 => fname | some pos => String.extract fname 0 pos | none => fname) (System.FilePath.fileName p)
Equations
- System.FilePath.extension p = Option.bind (System.FilePath.fileName p) fun fname => match String.revPosOf fname (Char.ofNat 46) with | some 0 => none | some pos => some (String.extract fname (pos + 1) (String.bsize fname)) | none => none
Equations
- System.FilePath.withFileName p fname = match System.FilePath.parent p with | none => { toString := fname } | some p => p / fname
Equations
- System.FilePath.withExtension p ext = match System.FilePath.fileStem p with | none => p | some stem => System.FilePath.withFileName p (if String.isEmpty ext = true then stem else stem ++ "." ++ ext)
Equations
Equations
- System.mkFilePath parts = { toString := String.intercalate (Char.toString System.FilePath.pathSeparator) parts }
Equations
- System.instCoeStringFilePath = { coe := System.FilePath.mk }
Equations
- System.SearchPath.separator = if System.Platform.isWindows = true then Char.ofNat 59 else Char.ofNat 58
Equations
- System.SearchPath.parse s = List.map System.FilePath.mk (String.split s fun c => System.SearchPath.separator == c)