Declares filesystem utility helpers.
More...
#include <cstdint>
#include <string>
#include <string_view>
Go to the source code of this file.
Declares filesystem utility helpers.
◆ ensure_directory_exists()
| bool platform::ensure_directory_exists |
( |
const std::string & | directoryPath, |
|
|
std::string * | errorMessage = nullptr ) |
Ensure that a directory path exists, creating missing segments as needed.
- Parameters
-
| directoryPath | Directory path to create. |
| errorMessage | Optional output for creation failures. |
- Returns
- True when the directory exists or was created successfully.
◆ file_name_from_path()
| std::string platform::file_name_from_path |
( |
std::string_view | path | ) |
|
Return the last path component from a file path.
- Parameters
-
- Returns
- Final path component, or the original string when no separator exists.
◆ is_path_separator()
| bool platform::is_path_separator |
( |
char | character | ) |
|
Return whether a character is recognized as a path separator.
- Parameters
-
| character | Character to inspect. |
- Returns
- True when the character is a supported path separator.
◆ join_path()
| std::string platform::join_path |
( |
const std::string & | left, |
|
|
const std::string & | right ) |
Join two path components using the preferred platform separator.
- Parameters
-
| left | Left path component. |
| right | Right path component. |
- Returns
- Joined path.
◆ parent_directory()
| std::string platform::parent_directory |
( |
std::string_view | filePath | ) |
|
Return the parent directory portion of a file path.
- Parameters
-
| filePath | File path to inspect. |
- Returns
- Parent directory path, or an empty string when none exists.
◆ path_has_prefix()
| bool platform::path_has_prefix |
( |
const std::string & | path, |
|
|
const std::string & | prefix ) |
Return whether a path begins with the requested prefix.
- Parameters
-
| path | Full path to inspect. |
| prefix | Prefix to compare against. |
- Returns
- True when the path starts with the prefix.
◆ preferred_path_separator()
| char platform::preferred_path_separator |
( |
| ) |
|
Return the preferred path separator for the active platform.
- Returns
- Preferred path separator character.
◆ try_get_file_size()
| bool platform::try_get_file_size |
( |
std::string_view | path, |
|
|
std::uint64_t * | sizeBytes = nullptr ) |
Try to read the size of a regular file.
- Parameters
-
| path | File path to inspect. |
| sizeBytes | Optional output for the file size in bytes. |
- Returns
- True when the path exists and is a regular file.