file normalize

Gives the full path with each . and .. removed.

file normalize NAME

Description

Gives the absolute form of NAME: a relative path starts at the working folder, and each . and .. part goes away. In the root folder the result starts at its /, and a path that leaves the root folder is an error. The file does not need to exist.

Arguments

ArgumentTypeDefaultDescription
NAMEpathrequiredThe path.

Returns

The full path.

Examples

% file normalize a/../b/./c
/b/c

% file normalize /x/y
/x/y

Errors

% file normalize ../../x
couldn't access "../../x": permission denied
-errorcode POSIX EACCES {permission denied}

% file normalize
wrong # args: should be "file normalize name"
-errorcode TCL WRONGARGS

Facts

Capability
file. A new interpreter does not have it until the host turns it on.
Tcl release
Tcl 9.1 and 8.6.
Since
ztcl 1.0.0-beta.1

See also