FileTools
CanonicalPath
get canonical filepath
Calling Sequence
Parameters
Description
Examples
Compatibility
CanonicalPath(path, directory)
path
-
string; filepath, relative or absolute
directory
(optional) string; directory to which relative paths refer
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.
currentdir⁡/Users/mapleuser:
FileToolsCanonicalPath⁡../otheruser
/Users/otheruser
FileToolsCanonicalPath⁡passwd,/etc
/etc/passwd
The absolute path /home/maple is returned verbatim.
FileToolsCanonicalPath⁡/home/maple
/home/maple
The FileTools[CanonicalPath] command was introduced in Maple 2018.
For more information on Maple 2018 changes, see Updates in Maple 2018.
See Also
FileTools[AbsolutePath]
FileTools[Exists]
FileTools[IsDirectory]
FileTools[IsExecutable]
FileTools[IsLink]
FileTools[IsReadable]
FileTools[IsWritable]
FileTools[MakeDirectory]
Download Help Document