std::pathFile path and glob utilities.
Manipulate file paths (join, split, check existence) and expand glob patterns to lists of matching paths.
import std::path;
fn main() {
let dir = path.dirname("/home/user/file.txt");
let ext = path.extension("photo.jpg");
let result = path.glob("*.hew");
for i in 0..result.count() {
println(result.get(i));
}
result.free();
}
globExpand a glob pattern and return all matching paths.
let files = path.glob("src/**/*.hew");
combineCombine two path segments with the platform path separator.
path.combine("/home/user", "file.txt") // "/home/user/file.txt"
dirnameReturn the directory portion of a path.
path.dirname("/home/user/file.txt") // "/home/user"
basenameReturn the final component of a path.
path.basename("/home/user/file.txt") // "file.txt"
extensionReturn the file extension (without the dot).
path.extension("photo.jpg") // "jpg"
existsTest whether a path exists on the filesystem.
is_fileTest whether a path refers to a regular file.
is_dirTest whether a path refers to a directory.
absoluteReturn the absolute form of a path.
strip_trailing_slashStrip a single trailing slash from a path, preserving the root /.
last_slash_posReturn the index of the last / in s, or -1 if none.
last_dot_posReturn the index of the last . in s, or -1 if none.
GlobResultThe result of a glob expansion.
Created by path.glob(pattern). Must be freed with free() when
no longer needed to avoid leaking memory.
GlobResultMethodsMethods available on a GlobResult.