std/staticos (original) (raw)

Source Edit

This module implements path handling like os module but works at only compile-time. This module works even when cross compiling to OS that is not supported by os module.

Types

PathComponent = enum pcFile,
pcLinkToFile,
pcDir,
pcLinkToDir

Enumeration specifying a path component.

See also:

Procs

proc staticDirExists(dir: string): bool {.compileTime, ...raises: [], tags: [], forbids: [].}

Returns true if the directory dir exists. If dir is a file, false is returned. Follows symlinks.Source Edit

proc staticFileExists(filename: string): bool {.compileTime, ...raises: [], tags: [], forbids: [].}

Returns true if filename exists and is a regular file or symlink.

Directories, device files, named pipes and sockets return false.

Source Edit

proc staticWalkDir(dir: string; relative = false): seq[ tuple[kind: PathComponent, path: string]] {.compileTime, ...raises: [], tags: [], forbids: [].}

Walks over the directory dir and returns a seq with each directory or file in dir. The component type and full path for each item are returned.

Walking is not recursive.