CanonicalPath - Maple Help

FileTools

 CanonicalPath
 get canonical filepath

 Calling Sequence CanonicalPath(path, directory)

Parameters

 path - string; filepath, relative or absolute directory - (optional) string; directory to which relative paths refer

Description

 • The CanonicalPath(path, directory) command returns an equivalent of the path which is an canonical path, that is, a filepath independent of the value of the current directory in which any symbolic links and the special directories . and .. have been resolved.
 • The optional argument directory specifies the directory to which path refers, if it is relative.  Its default value is the current directory as provided by the currentdir command.  The argument directory must itself be an absolute path.

Examples

 > $\mathrm{currentdir}\left("/Users/mapleuser"\right):$
 > $\mathrm{FileTools}\left[\mathrm{CanonicalPath}\right]\left("../otheruser"\right)$
 ${"/Users/otheruser"}$ (1)
 > $\mathrm{FileTools}\left[\mathrm{CanonicalPath}\right]\left("passwd","/etc"\right)$
 ${"/etc/passwd"}$ (2)

The absolute path /home/maple is returned verbatim.

 > $\mathrm{FileTools}\left[\mathrm{CanonicalPath}\right]\left("/home/maple"\right)$
 ${"/home/maple"}$ (3)

Compatibility

 • The FileTools[CanonicalPath] command was introduced in Maple 2018.