Paths (OpScript)

Testing and Matching

PathUtils.IsAncestorOrEqual(string pathA, string pathB) boolean
PathUtils.IsAncestor(string pathA, string pathB) boolean
PathUtils.IsRelativePath(string path) boolean
PathUtils.FnMatch(string testpath, string pattern) boolean, boolean
PathUtils.ExactMatch(string testpath, string matchpath) boolean, boolean
PathUtils.Compare(string pathA, string pathB) int

Compares two scene graph location paths. Returns a negative value if pathA sorts before pathB, zero if both paths compare equal, and a positive value if pathA sorts after pathB.

Each path component of pathA is compared lexicographically with the corresponding component of pathB. The function assumes normalized, absolute paths (except for superfluous trailing slashes, which are ignored).

Extracting Components

PathUtils.GetLeafName(string path) string
PathUtils.GetLeafAndParent(string path) string, string
PathUtils.GetLocationParent(string path) string
PathUtils.GetLocationStack(string path[, string rootPath]) table<string>

Path Manipulation

PathUtils.Join(string pathA, string pathB) string
PathUtils.NormalizedRelativePath(string rootPath, string path) string
PathUtils.NormalizeAbsPath(string path) string
PathUtils.RelativePath(string rootPath, string path) string
PathUtils.RelativeToAbsPath(string rootPath, string path) string

Identifiers

PathUtils.MakeUniqueName(string baseName, table<string> existingNames) string
PathUtils.MakeSafeIdentifier(string ident) string