sdlOpenUserStorage function storage
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.
\param org the name of your organization. \param app the name of your application. \param props a property list that may contain backend-specific information. \returns a user storage container on success or NULL on failure; call SDL_GetError() for more information.
\since This function is available since SDL 3.2.0.
\sa SDL_CloseStorage \sa SDL_GetStorageFileSize \sa SDL_GetStorageSpaceRemaining \sa SDL_OpenTitleStorage \sa SDL_ReadStorageFile \sa SDL_StorageReady \sa SDL_WriteStorageFile
extern SDL_DECLSPEC SDL_Storage * SDLCALL SDL_OpenUserStorage(const char *org, const char *app, SDL_PropertiesID props)
Implementation
Pointer<SdlStorage> sdlOpenUserStorage(String? org, String? app, int props) {
final sdlOpenUserStorageLookupFunction = _libSdl
.lookupFunction<
Pointer<SdlStorage> Function(
Pointer<Utf8> org,
Pointer<Utf8> app,
Uint32 props,
),
Pointer<SdlStorage> Function(
Pointer<Utf8> org,
Pointer<Utf8> app,
int props,
)
>('SDL_OpenUserStorage');
final orgPointer = org != null ? org.toNativeUtf8() : nullptr;
final appPointer = app != null ? app.toNativeUtf8() : nullptr;
final result = sdlOpenUserStorageLookupFunction(
orgPointer,
appPointer,
props,
);
calloc
..free(orgPointer)
..free(appPointer);
return result;
}