sdlGetStoragePathInfo function

bool sdlGetStoragePathInfo(
  1. Pointer<SdlStorage> storage,
  2. String? path,
  3. Pointer<SdlPathInfo> info
)

Get information about a filesystem path in a storage container.

\param storage a storage container. \param path the path to query. \param info a pointer filled in with information about the path, or NULL to check for the existence of a file. \returns true on success or false if the file doesn't exist, or another 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_GetStoragePathInfo(SDL_Storage *storage, const char *path, SDL_PathInfo *info)

Implementation

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