Equations
- System.instInhabitedFilePath = { default := { toString := default } }
Equations
Equations
- System.instHashableFilePath = { hash := [anonymous] }
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
The character that separates directories. In the case where more than one character is possible, pathSeparator
is the 'ideal' one.
Equations
- System.FilePath.pathSeparators = if System.Platform.isWindows = true then [Char.ofNat 92, Char.ofNat 47] else [Char.ofNat 47]
The list of all possible separators.
Equations
File extension character
Equations
- System.FilePath.exeExtension = if System.Platform.isWindows = true then "exe" else ""
Case-insensitive file system
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.length p.toString > 1) && String.Iterator.curr (String.Iterator.next (String.iter p.toString)) == 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 { byteIdx := 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 + Char.ofNat 47) (String.endPos 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 { byteIdx := 0 } => fname | some pos => String.extract fname 0 pos | none => fname) (System.FilePath.fileName p)
Extracts the stem (non-extension) part of p.fileName
.
Equations
- System.FilePath.extension p = Option.bind (System.FilePath.fileName p) fun fname => match String.revPosOf fname (Char.ofNat 46) with | some { byteIdx := 0 } => none | some pos => some (String.extract fname (pos + Char.ofNat 46) (String.endPos 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
The character that is used to separate the entries in the $PATH (or %PATH%) environment variable.
Equations
- System.SearchPath.parse s = List.map System.FilePath.mk (String.split s fun c => System.SearchPath.separator == c)