sdlCreateStorageDirectory function

bool sdlCreateStorageDirectory(
  1. Pointer<SdlStorage> storage,
  2. String? path
)

Create a directory in a writable storage container.

\param storage a storage container. \param path the path of the directory to create. \returns true on success or false on failure; call SDL_GetError() for more information.

\since This function is available since SDL 3.1.3.

\sa SDL_StorageReady

extern SDL_DECLSPEC bool SDLCALL SDL_CreateStorageDirectory(SDL_Storage *storage, const char *path)

Implementation

bool sdlCreateStorageDirectory(Pointer<SdlStorage> storage, String? path) {
  final sdlCreateStorageDirectoryLookupFunction = libSdl3.lookupFunction<
      Uint8 Function(Pointer<SdlStorage> storage, Pointer<Utf8> path),
      int Function(Pointer<SdlStorage> storage,
          Pointer<Utf8> path)>('SDL_CreateStorageDirectory');
  final pathPointer = path != null ? path.toNativeUtf8() : nullptr;
  final result =
      sdlCreateStorageDirectoryLookupFunction(storage, pathPointer) == 1;
  calloc.free(pathPointer);
  return result;
}