carb::extras::resolvePathAliases
Defined in carb/extras/Tokens.h
-
inline std::string carb::extras::resolvePathAliases(const char *srcBuf)
Replaces path alias markers in a path with the full names.
Remark
This resolves a path string by replacing path alias markers with their full paths. Markers must be registered with registerPathAlias() in order to be replaced. This will always return a new string, but not all of the markers may have been replaced in it is unregistered markers were found.
Remark
A replaced path will never end in a trailing path separator. It is the caller’s responsibility to ensure the marker(s) in the string are appropriately separated from other path components. This behavior does however allow for path aliases to be used to construct multiple path names by piecing together different parts of a name.
Note
This operation is always thread safe.
- Parameters
srcBuf – [in] The path to potentially replace path alias markers in. Any path alias markers in the string must be surrounded by “${” and “}” characters (ie: “${exampleMarker}/file.txt”). The markers will only be replaced if a path alias using the same marker name (“exampleMarker” in the previous example) is currently registered.
- Returns
A string containing the resolved path if path alias markers were replaced.
- Returns
A string containing the original path if no path alias markers were found or replaced.