sdlRenameStoragePath function
Rename a file or directory 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_RenameStoragePath(SDL_Storage *storage, const char *oldpath, const char *newpath)
Implementation
bool sdlRenameStoragePath(
Pointer<SdlStorage> storage, String? oldpath, String? newpath) {
final sdlRenameStoragePathLookupFunction = 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_RenameStoragePath');
final oldpathPointer = oldpath != null ? oldpath.toNativeUtf8() : nullptr;
final newpathPointer = newpath != null ? newpath.toNativeUtf8() : nullptr;
final result = sdlRenameStoragePathLookupFunction(
storage, oldpathPointer, newpathPointer) ==
1;
calloc.free(oldpathPointer);
calloc.free(newpathPointer);
return result;
}