sdlCopyStorageFile function
Copy a file in a writable storage container.
\param storage a storage container. \param oldpath the old path. \param newpath the new path. \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_CopyStorageFile(SDL_Storage *storage, const char *oldpath, const char *newpath)
Implementation
bool sdlCopyStorageFile(
Pointer<SdlStorage> storage, String? oldpath, String? newpath) {
final sdlCopyStorageFileLookupFunction = libSdl3.lookupFunction<
Uint8 Function(Pointer<SdlStorage> storage, Pointer<Utf8> oldpath,
Pointer<Utf8> newpath),
int Function(Pointer<SdlStorage> storage, Pointer<Utf8> oldpath,
Pointer<Utf8> newpath)>('SDL_CopyStorageFile');
final oldpathPointer = oldpath != null ? oldpath.toNativeUtf8() : nullptr;
final newpathPointer = newpath != null ? newpath.toNativeUtf8() : nullptr;
final result = sdlCopyStorageFileLookupFunction(
storage, oldpathPointer, newpathPointer) ==
1;
calloc.free(oldpathPointer);
calloc.free(newpathPointer);
return result;
}