This documentation was styled with a demo skin from the Premium Pack 4 add-on for Help & Manual. The contents of the skin are encrypted and not configurable. You can only publish HM projects with this skin. You cannot edit it or change it.
This version is copyright and may only be used for local testing purposes. It may not be distributed.
Please purchase the full version of the Premium Pack to get the configurable skins and remove this notice. The package will also include the Toolbox configuration utility for Premium Pack skins.
Description
Simplifies a path by removing navigation elements such as "." and ".." to produce a direct, well-formed path.
Syntax
sPath = Path_Canonicalize(sPath)
Returns
String.
Parameters
Name |
Type |
Optional |
Meaning |
sPath |
String |
No |
A disk path |
References
https://learn.microsoft.com/en-us/windows/win32/api/shlwapi/nf-shlwapi-pathcanonicalizea
Remarks
Restrictions
sPath parameter must be a path only. Do not pass path + file name. Only path.
See also
Examples
uses "File"
uses "Console"
string sPath
sPath = "A:\name_1\.\name_2\..\name_3"
printl sPath, $tab(4), "Path_Canonicalize:", Path_Canonicalize(sPath)
sPath = "A:\name_1\..\name_2\.\name_3"
printl sPath, $tab(4), "Path_Canonicalize:", Path_Canonicalize(sPath)
sPath = "A:\name_1\name_2\.\name_3\..\name_4"
printl sPath, $tab(3), "Path_Canonicalize:", Path_Canonicalize(sPath)
sPath = "A:\name_1\.\name_2\.\name_3\..\name_4\.."
printl sPath, $tab(2), "Path_Canonicalize:", Path_Canonicalize(sPath)
sPath = "C:\.."
printl sPath, $tab(7), "Path_Canonicalize:", Path_Canonicalize(sPath)
sPath = "\\Server\Resource\name_1\name_2\.\name_3\..\name_4"
printl sPath, $tab(1), "Path_Canonicalize:", Path_Canonicalize(sPath)
WaitKey