pathcmp

File path comparison function; like C function strcmp() but for paths:

  pathcmp(pathA, pathB)

Returns an integer indicating the sort order of pathA relative to pathB: 0 if pathA is the same as pathB, less than 0 if pathA is less than pathB, greater than 0 if pathA is greater than pathB. Paths are compared case-insensitively if and only if the OS is case-insensitive for paths, and OS-specific alternate directory separators are considered the same (e.g. "{\" and "/" in Windows). Multiple consecutive directory separators are considered the same as one. A trailing directory separator (if not also a leading separator) is ignored. Directory separators sort lexically before any other character.

Note that the paths are only compared lexically: no attempt is made to resolve symbolic links, ".." path components, etc. Note also that no inference should be made about the magnitude of negative or positive return values: greater magnitude does not necessarily indicate greater lexical "separation", nor should it be assumed that comparing the same two paths will always yield the same-magnitude value in future versions. Only the sign of the return value is significant. Added in version 5.01.1139446515 20060208.


Copyright © Thunderstone Software     Last updated: Jun 9 2017
Copyright © 2017 Thunderstone Software LLC. All rights reserved.