Module: Path

A file utilities library, specifically related to path operations

The Path module focuses on manipulation of the path to a file or directory. Also provided are constant values representing common idioms that may vary across operating systems (though rarely in the modern era), such as general references to a parent directory or the current directory.

Note

This module is currently under development and will expand significantly in upcoming releases. Stay tuned!

Operations which occur on the files or directories referred to by these paths may be found in FileSystem (for operations on the file) or IO (for operations within the file).

const curDir = "."

Represents generally the current directory

const parentDir = ".."

Represents generally the parent directory

const pathSep = "/"

Denotes the separator between a directory and its child.

proc realPath(name: string): string

Given a path name, attempts to determine the canonical path referenced. This resolves and removes any curDir and parentDir uses present, as well as any symbolic links. Returns the result

Will halt with an error message if one is detected.

Arguments:name : string – A path to resolve. If the path does not refer to a valid file or directory, an error will occur.
Returns:A canonical version of the argument.
Return type:string
proc file.realPath(): string

Determines the canonical path referenced by the file record performing this operation. This resolves and removes any curDir and parentDir uses present, as well as any symbolic links. Returns the result

Will halt with an error message if one is detected.

Returns:A canonical path to the file referenced by this file record. If the file record is not valid, an error will occur
Return type:string