Basic platform-specific file system functions.
More...
#include <BasicFileSystem.hpp>
|
static std::vector< String > | SplitPath (const Char *Path, bool Simplify) |
|
static std::string | BuildPathFromComponents (const std::vector< String > &Components, Char Slash=0) |
| Builds a path from the given components.
|
|
static std::string | SimplifyPath (const Char *Path, Char Slash=0) |
| Simplifies the path.
|
|
template<typename CallbackType> |
static void | SplitPathList (const Char *PathList, CallbackType Callback, const char Separator=';') |
|
static std::string | GetRelativePath (const Char *PathFrom, bool IsFromDirectory, const Char *PathTo, bool IsToDirectory) |
| Returns a relative path from one file or folder to another.
|
|
Basic platform-specific file system functions.
◆ GetRelativePath()
static std::string Diligent::BasicFileSystem::GetRelativePath |
( |
const Char * | PathFrom, |
|
|
bool | IsFromDirectory, |
|
|
const Char * | PathTo, |
|
|
bool | IsToDirectory ) |
|
static |
Returns a relative path from one file or folder to another.
- Parameters
-
[in] | PathFrom | - Path that defines the start of the relative path. Must not be null. |
[in] | IsFromDirectory | - Indicates if PathFrom is a directory. |
[in] | PathTo | - Path that defines the endpoint of the relative path. Must not be null. |
[in] | IsToDirectory | - Indicates if PathTo is a directory. |
- Returns
- Relative path from PathFrom to PathTo. If no relative path exists, PathFrom is returned.
◆ SimplifyPath()
static std::string Diligent::BasicFileSystem::SimplifyPath |
( |
const Char * | Path, |
|
|
Char | Slash = 0 ) |
|
static |
Simplifies the path.
The function performs the following path simplifications:
- Normalizes slashes using the given slash symbol (
a\b/c -> a/b/c
)
- Removes redundant slashes (
a///b -> a/b
)
- Removes redundant
.
(a/./b
-> a/b
)
- Collapses
..
(a/b/../c -> a/c
)
- Removes trailing slashes (
/a/b/c/ -> /a/b/c
)
- When 'Slash' is Windows slash (
\
), removes leading slashes (\a\b\c -> a\b\c
)
◆ SplitPath()
static std::vector< String > Diligent::BasicFileSystem::SplitPath |
( |
const Char * | Path, |
|
|
bool | Simplify ) |
|
static |
Splits path into individual components optionally simplifying it.
If Simplify is true:
- Removes redundant slashes (
a///b -> a/b
)
- Removes redundant
.
(a/./b -> a/b
)
- Collapses
..
(a/b/../c -> a/c
)
◆ SplitPathList()
template<typename CallbackType>
static void Diligent::BasicFileSystem::SplitPathList |
( |
const Char * | PathList, |
|
|
CallbackType | Callback, |
|
|
const char | Separator = ';' ) |
|
inlinestatic |
Splits a list of paths separated by a given separator and calls a user callback for every individual path. Empty paths are skipped.