|
bool | Ready () const |
| Checks if the storage container is ready to use.
|
|
std::optional< Uint64 > | GetFileSize (StringParam path) const |
| Query the size of a file within a storage container.
|
|
std::string | ReadFile (StringParam path) const |
| Synchronously read a file from a storage container into a client-provided buffer.
|
|
bool | ReadFile (StringParam path, TargetBytes destination) const |
| Synchronously read a file from a storage container into a client-provided buffer.
|
|
template<class T > |
std::vector< T > | ReadFileAs (StringParam path) const |
| Synchronously read a file from a storage container into a client-provided buffer.
|
|
void | WriteFile (StringParam path, SourceBytes source) |
| Synchronously write a file from client memory into a storage container.
|
|
void | CreateDirectory (StringParam path) |
| Create a directory in a writable storage container.
|
|
std::vector< Path > | EnumerateDirectory (StringParam path) |
| Enumerate a directory.
|
|
void | EnumerateDirectory (StringParam path, EnumerateDirectoryCB callback) |
| Enumerate a directory in a storage container through a callback function.
|
|
void | EnumerateDirectory (StringParam path, EnumerateDirectoryCallback callback, void *userdata) |
| Enumerate a directory in a storage container through a callback function.
|
|
void | RemovePath (StringParam path) |
| Remove a file or an empty directory in a writable storage container.
|
|
void | RenamePath (StringParam oldpath, StringParam newpath) |
| Rename a file or directory in a writable storage container.
|
|
void | CopyFile (StringParam oldpath, StringParam newpath) |
| Copy a file in a writable storage container.
|
|
PathInfo | GetPathInfo (StringParam path) const |
| Get information about a filesystem path in a storage container.
|
|
Uint64 | GetSpaceRemaining () const |
| Queries the remaining space in a storage container.
|
|
OwnArray< char * > | GlobDirectory (StringParam path, StringParam pattern, GlobFlags flags) |
| Enumerate a directory tree, filtered by pattern, and return a list.
|
|
constexpr | Resource (T resource={}) |
| Constructs from the underlying resource.
|
|
constexpr | Resource (const ResourceHandle< Resource< T > > auto &resource) |
| Constructs from pointer like.
|
|
constexpr | Resource (std::nullptr_t) |
| Equivalent to default ctor.
|
|
constexpr | Resource (std::nullopt_t) |
| Equivalent to default ctor.
|
|
constexpr | Resource (SDL_Storage * resource={}) |
| Constructs from the underlying resource.
|
|
constexpr | Resource (const ResourceHandle< Resource< SDL_Storage * > > auto &resource) |
| Constructs from pointer like.
|
|
constexpr | Resource (std::nullptr_t) |
| Equivalent to default ctor.
|
|
constexpr | Resource (std::nullopt_t) |
| Equivalent to default ctor.
|
|
constexpr | operator bool () const |
| True if contains a valid resource.
|
|
constexpr | operator value_type () const |
| Converts back to underlying type.
|
|
constexpr bool | operator== (const Resource &other) const=default |
| Comparison.
|
|
constexpr bool | operator== (std::nullopt_t) const |
| Comparison.
|
|
constexpr bool | operator== (std::nullptr_t) const |
| Comparison.
|
|
constexpr SDL_Storage * | get () const |
| Return contained resource;.
|
|
constexpr const SDL_Storage * | operator-> () const |
| Access to fields.
|
|
constexpr SDL_Storage * | operator-> () |
| Access to fields.
|
|
This is an opaque datatype. One can create this object using standard SDL functions like Storage.OpenTitle or Storage.OpenUser, etc, or create an object with a custom implementation using Storage.Open.
- Since
- This struct is available since SDL 3.2.0.
- Category:
- Resource
- See also
- Storage
This function provides every directory entry through an app-provided callback, called once for each directory entry, until all results have been provided or the callback returns either ENUM_SUCCESS or ENUM_FAILURE.
This will return false if there was a system problem in general, or if a callback returns ENUM_FAILURE. A successful return means a callback returned ENUM_SUCCESS to halt enumeration, or all directory entries were enumerated.
If path
is nullptr, this is treated as a request to enumerate the root of the storage container's tree. An empty string also works for this.
- Parameters
-
path | the path of the directory to enumerate, or nullptr for the root. |
callback | a function that is called for each entry in the directory. |
userdata | a pointer that is passed to callback . |
- Exceptions
-
- Since
- This function is available since SDL 3.2.0.
- See also
- StorageRef.Ready
This function provides every directory entry through an app-provided callback, called once for each directory entry, until all results have been provided or the callback returns either ENUM_SUCCESS or ENUM_FAILURE.
This will return false if there was a system problem in general, or if a callback returns ENUM_FAILURE. A successful return means a callback returned ENUM_SUCCESS to halt enumeration, or all directory entries were enumerated.
If path
is nullptr, this is treated as a request to enumerate the root of the storage container's tree. An empty string also works for this.
- Parameters
-
path | the path of the directory to enumerate, or nullptr for the root. |
callback | a function that is called for each entry in the directory. |
- Exceptions
-
- Since
- This function is available since SDL 3.2.0.
- See also
- StorageRef.Ready
Files are filtered out if they don't match the string in pattern
, which may contain wildcard characters *
(match everything) and ?
(match one character). If pattern is nullptr, no filtering is done and all results are returned. Subdirectories are permitted, and are specified with a path separator of '/'. Wildcard characters *
and ?
never match a path separator.
flags
may be set to GLOB_CASEINSENSITIVE to make the pattern matching case-insensitive.
The returned array is always nullptr-terminated, for your iterating convenience, but if count
is non-nullptr, on return it will contain the number of items in the array, not counting the nullptr terminator.
If path
is nullptr, this is treated as a request to enumerate the root of the storage container's tree. An empty string also works for this.
- Parameters
-
path | the path of the directory to enumerate, or nullptr for the root. |
pattern | the pattern that files in the directory must match. Can be nullptr. |
flags | SDL_GLOB_* bitflags that affect this search. |
- Returns
- an array of strings on success.
- Exceptions
-
- Thread safety:
- It is safe to call this function from any thread, assuming the
storage
object is thread-safe.
- Since
- This function is available since SDL 3.2.0.