SDL 3.0
|
#include <SDL3/SDL_stdinc.h>
#include <SDL3/SDL_error.h>
#include <SDL3/SDL_filesystem.h>
#include <SDL3/SDL_properties.h>
#include <SDL3/SDL_begin_code.h>
#include <SDL3/SDL_close_code.h>
Go to the source code of this file.
Data Structures | |
struct | SDL_StorageInterface |
Typedefs | |
typedef struct SDL_Storage | SDL_Storage |
typedef struct SDL_Storage SDL_Storage |
An abstract interface for filesystem access.
This is an opaque datatype. One can create this object using standard SDL functions like SDL_OpenTitleStorage or SDL_OpenUserStorage, etc, or create an object with a custom implementation using SDL_OpenStorage.
Definition at line 119 of file SDL_storage.h.
|
extern |
Closes and frees a storage container.
storage | a storage container to close. |
SDL_COMPILE_TIME_ASSERT | ( | SDL_StorageInterface_SIZE | , |
(sizeof(void *)==4 &&sizeof(SDL_StorageInterface)==48)||(sizeof(void *)==8 &&sizeof(SDL_StorageInterface)==96) | |||
) |
|
extern |
Copy a file in a writable storage container.
storage | a storage container. |
oldpath | the old path. |
newpath | the new path. |
|
extern |
Create a directory in a writable storage container.
storage | a storage container. |
path | the path of the directory to create. |
|
extern |
Enumerate a directory in a storage container through a callback function.
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 <= 0.
storage | a storage container. |
path | the path of the directory to enumerate. |
callback | a function that is called for each entry in the directory. |
userdata | a pointer that is passed to callback . |
|
extern |
Query the size of a file within a storage container.
storage | a storage container to query. |
path | the relative path of the file to query. |
length | a pointer to be filled with the file's length. |
|
extern |
Get information about a filesystem path in a storage container.
storage | a storage container. |
path | the path to query. |
info | a pointer filled in with information about the path, or NULL to check for the existence of a file. |
|
extern |
Queries the remaining space in a storage container.
storage | a storage container to query. |
|
extern |
Enumerate a directory tree, filtered by pattern, and return a list.
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 NULL, 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 SDL_GLOB_CASEINSENSITIVE to make the pattern matching case-insensitive.
The returned array is always NULL-terminated, for your iterating convenience, but if count
is non-NULL, on return it will contain the number of items in the array, not counting the NULL terminator.
storage | a storage container. |
path | the path of the directory to enumerate. |
pattern | the pattern that files in the directory must match. Can be NULL. |
flags | SDL_GLOB_* bitflags that affect this search. |
count | on return, will be set to the number of items in the returned array. Can be NULL. |
\threadsafety It is safe to call this function from any thread, assuming the storage
object is thread-safe.
|
extern |
Opens up a container for local filesystem storage.
This is provided for development and tools. Portable applications should use SDL_OpenTitleStorage() for access to game data and SDL_OpenUserStorage() for access to user data.
path | the base path prepended to all storage paths, or NULL for no base path. |
|
extern |
Opens up a container using a client-provided storage interface.
Applications do not need to use this function unless they are providing their own SDL_Storage implementation. If you just need an SDL_Storage, you should use the built-in implementations in SDL, like SDL_OpenTitleStorage() or SDL_OpenUserStorage().
This function makes a copy of iface
and the caller does not need to keep it around after this call.
iface | the interface that implements this storage, initialized using SDL_INIT_INTERFACE(). |
userdata | the pointer that will be passed to the interface functions. |
|
extern |
Opens up a read-only container for the application's filesystem.
override | a path to override the backend's default title root. |
props | a property list that may contain backend-specific information. |
|
extern |
Opens up a container for a user's unique read/write filesystem.
While title storage can generally be kept open throughout runtime, user storage should only be opened when the client is ready to read/write files. This allows the backend to properly batch file operations and flush them when the container has been closed; ensuring safe and optimal save I/O.
org | the name of your organization. |
app | the name of your application. |
props | a property list that may contain backend-specific information. |
|
extern |
Synchronously read a file from a storage container into a client-provided buffer.
storage | a storage container to read from. |
path | the relative path of the file to read. |
destination | a client-provided buffer to read the file into. |
length | the length of the destination buffer. |
|
extern |
Remove a file or an empty directory in a writable storage container.
storage | a storage container. |
path | the path of the directory to enumerate. |
|
extern |
Rename a file or directory in a writable storage container.
storage | a storage container. |
oldpath | the old path. |
newpath | the new path. |
|
extern |
Checks if the storage container is ready to use.
This function should be called in regular intervals until it returns SDL_TRUE - however, it is not recommended to spinwait on this call, as the backend may depend on a synchronous message loop.
storage | a storage container to query. |
|
extern |
Synchronously write a file from client memory into a storage container.
storage | a storage container to write to. |
path | the relative path of the file to write. |
source | a client-provided buffer to write from. |
length | the length of the source buffer. |