sdlOpenFileStorage function

Pointer<SdlStorage> sdlOpenFileStorage(
  1. String? path
)

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.

\param path the base path prepended to all storage paths, or NULL for no base path. \returns a filesystem storage container on success or NULL on failure; call SDL_GetError() for more information.

\since This function is available since SDL 3.1.3.

\sa SDL_CloseStorage \sa SDL_GetStorageFileSize \sa SDL_GetStorageSpaceRemaining \sa SDL_OpenTitleStorage \sa SDL_OpenUserStorage \sa SDL_ReadStorageFile \sa SDL_WriteStorageFile

extern SDL_DECLSPEC SDL_Storage * SDLCALL SDL_OpenFileStorage(const char *path)

Implementation

Pointer<SdlStorage> sdlOpenFileStorage(String? path) {
  final sdlOpenFileStorageLookupFunction = libSdl3.lookupFunction<
      Pointer<SdlStorage> Function(Pointer<Utf8> path),
      Pointer<SdlStorage> Function(Pointer<Utf8> path)>('SDL_OpenFileStorage');
  final pathPointer = path != null ? path.toNativeUtf8() : nullptr;
  final result = sdlOpenFileStorageLookupFunction(pathPointer);
  calloc.free(pathPointer);
  return result;
}