|
Zen API
|
Collection of path manipulation functions.
Most of the functions in this class expect paths to be in normal form (canonical separator character, no trailing slashes). The kPath_Normalize function can be used to normalize paths prior to calling other kPath functions.
The kPath_ToNative function can be used to transform a path in normal form to to a form suitable for the underlying system (native separator).
Public Member Functions | |
| kStatus | kPath_Combine (const kChar *segment1, const kChar *segment2, kChar *path, kSize capacity) |
| Combines two path segments using the normalized path separator character. More... | |
| kStatus | kPath_Directory (const kChar *path, kChar *directory, kSize capacity) |
| Returns the parent directory for a given file or directory path. More... | |
| kStatus | kPath_Extension (const kChar *path, kChar *extension, kSize capacity) |
| Given a file path, returns the portion of the path containing the file extension. More... | |
| kStatus | kPath_FileName (const kChar *path, kChar *fileName, kSize capacity) |
| Given a file path, returns the portion of the path containing the file name. More... | |
| kBool | kPath_IsSeparator (kChar ch) |
| Determines if the given character is equal to the normalized path separator. More... | |
| kStatus | kPath_Normalize (const kChar *path, kChar *normalized, kSize capacity) |
| Transforms all path separators to normal form and removes trailing slashes. More... | |
| kChar | kPath_Separator () |
| Returns the normalized path separator character. More... | |
| kStatus | kPath_ToAbsolute (const kChar *pathA, const kChar *bRelativeToA, kChar *pathB, kSize capacity) |
| Finds the absolute path expressed by the combination of an absolute path and a relative path. More... | |
| kStatus | kPath_ToNative (const kChar *path, kChar *native, kSize capacity) |
| Transforms all path separators to native form. More... | |
| kStatus | kPath_ToRelative (const kChar *pathA, const kChar *pathB, kChar *bRelativeToA, kSize capacity) |
| Expresses an absolute path in relative form, in relation to a reference path. More... | |
| kStatus kPath_Combine | ( | const kChar * | segment1, |
| const kChar * | segment2, | ||
| kChar * | path, | ||
| kSize | capacity | ||
| ) |
Combines two path segments using the normalized path separator character.
The path (output) argument can refer to the same memory address as either of the segment (input) arguments.
| segment1 | First path segment. |
| segment2 | Second path segment. |
| path | Receives the combined path segments. |
| capacity | Maximum number of characters (including null terminator). |
Returns the parent directory for a given file or directory path.
The directory (output) argument can refer to the same memory address as the path (input) argument.
If the path contains embedded relative path components, this function will not attempt to evaluate the meaning of those components.
| path | File or directory path. |
| directory | Receives the parent directory. |
| capacity | Maximum number of characters (including null terminator). |
Given a file path, returns the portion of the path containing the file extension.
The extension (output) argument can refer to the same memory address as the path (input) argument.
| path | File path. |
| extension | Receives the file extension portion of the path. |
| capacity | Maximum number of characters (including null terminator). |
Given a file path, returns the portion of the path containing the file name.
The fileName (output) argument can refer to the same memory address as the path (input) argument.
| path | File path. |
| fileName | Receives the file name portion of the path. |
| capacity | Maximum number of characters (including null terminator). |
Determines if the given character is equal to the normalized path separator.
| ch | Character to examine. |
Transforms all path separators to normal form and removes trailing slashes.
The normalized (output) argument can refer to the same memory address as the path (input) argument.
| path | Input path, in native or mixed form. |
| normalized | Receives transformed path, in normal form. |
| capacity | Maximum number of characters (including null terminator) for normalized path. |
| kChar kPath_Separator | ( | ) |
Returns the normalized path separator character.
| kStatus kPath_ToAbsolute | ( | const kChar * | pathA, |
| const kChar * | bRelativeToA, | ||
| kChar * | pathB, | ||
| kSize | capacity | ||
| ) |
Finds the absolute path expressed by the combination of an absolute path and a relative path.
If bRelativeToA is already expressed in absolute form, then pathB will receive an absolute path equal to bRelativeToA.
The pathB (output) argument can refer to the same memory address as either the pathA or bRelativeToA (input) arguments.
| pathA | Absolute reference path. |
| bRelativeToA | Path b, expressed as relative to path A. |
| pathB | Receives path b, expressed as an absolute path. |
| capacity | Maximum number of characters (including null terminator) for path b. |
Transforms all path separators to native form.
The native (output) argument can refer to the same memory address as the path (input) argument.
| path | Input path, in normal or mixed form. |
| native | Receives transformed path, in native form. |
| capacity | Maximum number of characters (including null terminator) for native path. |
| kStatus kPath_ToRelative | ( | const kChar * | pathA, |
| const kChar * | pathB, | ||
| kChar * | bRelativeToA, | ||
| kSize | capacity | ||
| ) |
Expresses an absolute path in relative form, in relation to a reference path.
If pathA and pathB are rooted in different volumes, then bRelativeToA will receive an absolute path equal to pathB.
The bRelativeToA (output) argument can refer to the same memory address as either the pathA or pathB (input) arguments.
| pathA | Absolute reference path. |
| pathB | Absolute path to be re-expressed as relative to path A. |
| bRelativeToA | Receives path b, expressed as relative to path A. |
| capacity | Maximum number of characters (including null terminator) for the relative path. |