Path manipulation helpers for engine resource and file paths.
More...
#include <Utils/CPath.h>
|
| static const std::string & | getFileName (const std::string &path) |
| | Get the file name, including extension, from a path.
|
| static const std::string & | getFileNameExt (const std::string &path) |
| | Get only the extension from a file path.
|
| static const std::string & | getFileNameNoExt (const std::string &path) |
| | Get the file name without its extension.
|
| static const std::string & | replaceFileExt (const std::string &path, const std::string &ext) |
| | Replace the extension of a file path.
|
| static const std::string & | getFolderPath (const std::string &path) |
| | Get the folder portion of a path.
|
| static const std::string & | getParentFolderPath (const std::string &path) |
| | Get the parent folder of a path or folder.
|
| static const std::string & | normalizePath (const std::string &path) |
| | Normalize slashes and collapse .. path elements.
|
| static const std::string & | getRelativePath (const std::string &path, const std::string &folder) |
| | Convert a path to be relative to a folder when they share a root.
|
| static bool | searchMatch (const std::string &path, const std::string &searchPattern) |
| | Match a file name against a simple wildcard pattern.
|
Path manipulation helpers for engine resource and file paths.
Most methods return a reference to a shared temporary string. Copy the returned value before calling another utility that may reuse the same temporary buffer.
◆ getFileName()
| const std::string & Skylicht::CPath::getFileName |
( |
const std::string & | path | ) |
|
|
static |
Get the file name, including extension, from a path.
- Parameters
-
- Returns
- File name stored in the shared temporary buffer.
◆ getFileNameExt()
| const std::string & Skylicht::CPath::getFileNameExt |
( |
const std::string & | path | ) |
|
|
static |
Get only the extension from a file path.
- Parameters
-
- Returns
- Extension without the dot, or an empty string when no extension exists.
◆ getFileNameNoExt()
| const std::string & Skylicht::CPath::getFileNameNoExt |
( |
const std::string & | path | ) |
|
|
static |
Get the file name without its extension.
- Parameters
-
- Returns
- File name without extension.
◆ getFolderPath()
| const std::string & Skylicht::CPath::getFolderPath |
( |
const std::string & | path | ) |
|
|
static |
Get the folder portion of a path.
- Parameters
-
- Returns
- Folder path without the file name.
◆ getParentFolderPath()
| const std::string & Skylicht::CPath::getParentFolderPath |
( |
const std::string & | path | ) |
|
|
static |
Get the parent folder of a path or folder.
- Parameters
-
- Returns
- Parent folder path.
◆ getRelativePath()
| const std::string & Skylicht::CPath::getRelativePath |
( |
const std::string & | path, |
|
|
const std::string & | folder ) |
|
static |
Convert a path to be relative to a folder when they share a root.
- Parameters
-
| path | Absolute or base path to convert. |
| folder | Folder used as the relative origin. |
- Returns
- Relative path, or the original path when no shared root exists.
◆ normalizePath()
| const std::string & Skylicht::CPath::normalizePath |
( |
const std::string & | path | ) |
|
|
static |
Normalize slashes and collapse .. path elements.
- Parameters
-
- Returns
- Normalized path.
◆ replaceFileExt()
| const std::string & Skylicht::CPath::replaceFileExt |
( |
const std::string & | path, |
|
|
const std::string & | ext ) |
|
static |
Replace the extension of a file path.
- Parameters
-
| path | Input path. |
| ext | New extension. |
- Returns
- Path with the new extension.
◆ searchMatch()
| bool Skylicht::CPath::searchMatch |
( |
const std::string & | path, |
|
|
const std::string & | searchPattern ) |
|
static |
Match a file name against a simple wildcard pattern.
Supports ? for one character and * for a variable number of characters. Matching is case-insensitive.
- Parameters
-
| path | Path whose file name will be tested. |
| searchPattern | Pattern to match. |
- Returns
- True if the file name matches the pattern.
The documentation for this class was generated from the following file: