sdlGetStorageFileSize function
Query the size of a file within a storage container.
\param storage a storage container to query. \param path the relative path of the file to query. \param length a pointer to be filled with the file's length. \returns true if the file could be queried or false on failure; call SDL_GetError() for more information.
\since This function is available since SDL 3.1.3.
\sa SDL_ReadStorageFile \sa SDL_StorageReady
extern SDL_DECLSPEC bool SDLCALL SDL_GetStorageFileSize(SDL_Storage *storage, const char *path, Uint64 *length)
Implementation
bool sdlGetStorageFileSize(
Pointer<SdlStorage> storage, String? path, Pointer<Uint64> length) {
final sdlGetStorageFileSizeLookupFunction = libSdl3.lookupFunction<
Uint8 Function(Pointer<SdlStorage> storage, Pointer<Utf8> path,
Pointer<Uint64> length),
int Function(Pointer<SdlStorage> storage, Pointer<Utf8> path,
Pointer<Uint64> length)>('SDL_GetStorageFileSize');
final pathPointer = path != null ? path.toNativeUtf8() : nullptr;
final result =
sdlGetStorageFileSizeLookupFunction(storage, pathPointer, length) == 1;
calloc.free(pathPointer);
return result;
}