Functions
Path existence test.
Follows symlinks and is true for any existing entry — file, directory, or other; returns false for a missing path.
p | the path. |
true iff p exists.
O(n) + a syscall.
none.
The answer is a snapshot: the entry can be created or removed between this check and any subsequent use (TOCTOU) — do not rely on it as a security check.
CheatahOs.MakeDirExistsThenRemoveOsCompileRun.PathExistsStdlibE2E.Os SystemApps.EventLog SystemApps.IntegrityRegular-file test.
Returns false (rather than throwing) when p is missing or is a non-regular entry such as a directory; symlinks are followed to their target.
p | the path. |
true iff p is a regular file.
O(n) + a syscall.
none.
OsCompileRun.PathIsfileStdlibE2E.Os SystemApps.EventLogDirectory test.
Returns false (rather than throwing) when p is missing or is not a directory; symlinks are followed to their target.
p | the path. |
true iff p is a directory.
O(n) + a syscall.
none.
CheatahOs.MakeDirExistsThenRemoveOsCompileRun.PathIsdirStdlibE2E.OsFinal path component.
Returns the trailing filename component lexically, without touching the filesystem; a path ending in a separator (e.g. a/b/) yields an empty string, matching std::filesystem::path::filename.
p | the path. |
the basename (filename).
O(n).
allocates a path temporary and the result string.
CheatahOs.PathBasenameDirnameOsCompileRun.PathBasenameStdlibE2E.Os SystemApps.EventLogParent path.
Returns everything before the final component lexically, without touching the filesystem; a bare filename with no separator (e.g. file.txt) yields an empty string, matching std::filesystem::path::parent_path.
p | the path. |
the directory portion of p.
O(n).
allocates a path temporary and the result string.
CheatahOs.PathBasenameDirnameOsCompileRun.PathDirnameStdlibE2E.OsAbsolute path.
Prepends the current working directory to a relative p; it does not collapse ./.. segments or resolve symlinks (combine with normpath for that), and p need not exist.
p | the path. |
p resolved against the cwd.
O(n) + a syscall (reads the cwd).
allocates the result string.
CheatahOs.AbspathAndNormpathOsCompileRun.PathAbspathStdlibE2E.OsLexically normalized path (collapses current-dir and parent-dir segments).
p | the path. |
the normalized path.
O(n) (purely lexical, no syscall).
allocates a path temporary and the result string.
CheatahOs.AbspathAndNormpathOsCompileRun.PathNormpathStdlibE2E.Os SystemApps.EventLogFile size in bytes.
Defined only for regular files; querying a missing path, or a directory or other non-regular entry, throws rather than returning a sentinel.
p | the file path. |
p's size.
O(1) + a syscall.
none.
OsCompileRun.PathGetsizeStdlibE2E.Os SystemApps.IntegritySplit a path into root and extension.
Splits at the last dot of the final component so that concatenating the two results reproduces p; when there is no extension the whole path is the root and the extension is empty. The extension includes its leading dot, and a leading-dot name (e.g. .bashrc) is treated as having no extension.
p | the path. |
e.g. splitext("dir/file.purr") -> {"dir/file", ".purr"} (empty extension when none).
O(n).
allocates the two result strings and a path temporary.
CheatahOs.PathSplitextOsCompileRun.PathSplitextStdlibE2E.OsJoin path components with the platform separator.
Appends each component with path::operator/=, inserting a separator as needed; following std::filesystem rules, an absolute component discards everything joined before it. Purely lexical — the filesystem is not touched.
first | the first component. |
rest | any further string-constructible components. |
e.g. join("a","b","c") -> "a/b/c".
O(total length).
allocates the result string and per-part path temporaries.
CheatahOs.PathJoinOsCompileRun.PathJoinStdlibE2E.Os SystemApps.EventLog SystemApps.Integrity