CollapsePath (open)
Collapse a path containing duplicate slashes, '.' and '..' entries
Syntax
LOADLIB "wh::files.whlib";
STRING FUNCTION CollapsePath(STRING path)
Parameters
STRING path
Path to collapse
Return value
STRING
The cleaned and collapsed path
Description
This function returns the shortest possible path that points to the same location as the specified path. It also eliminates any '..' entries at the beginning of the path. Any terminating slash is also cleared, unless this path refers to a root directory.
Examples
//Prints "/a/b/c"
Print(CollapsePath("/a/b/g/../c/"));
//Prints "b" (because drive letters are ignored)
Print(CollapsePath("A:/../b"));