Paths (OpScript)
================

.. lua:module:: PathUtils

Testing and Matching
--------------------

.. lua:function:: IsAncestorOrEqual(string pathA, string pathB) -> boolean
.. lua:function:: IsAncestor(string pathA, string pathB) -> boolean
.. lua:function:: IsRelativePath(string path) -> boolean
.. lua:function:: FnMatch(string testpath, string pattern) -> boolean, boolean
.. lua:function:: ExactMatch(string testpath, string matchpath) -> boolean, boolean
.. lua:function:: 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
---------------------

.. lua:function:: GetLeafName(string path) -> string
.. lua:function:: GetLeafAndParent(string path) -> string, string
.. lua:function:: GetLocationParent(string path) -> string
.. lua:function:: GetLocationStack(string path, [string rootPath]) -> table<string>

Path Manipulation
-----------------

.. lua:function:: Join(string pathA, string pathB) -> string
.. lua:function:: NormalizedRelativePath(string rootPath, string path) -> string
.. lua:function:: NormalizeAbsPath(string path) -> string
.. lua:function:: RelativePath(string rootPath, string path) -> string
.. lua:function:: RelativeToAbsPath(string rootPath, string path) -> string

Identifiers
-----------

.. lua:function:: MakeUniqueName(string baseName, table<string> existingNames) -> string
.. lua:function:: MakeSafeIdentifier(string ident) -> string