sdlRemovePath function

bool sdlRemovePath(
  1. String? path
)

Remove a file or an empty directory.

Directories that are not empty will fail; this function will not recursely delete directory trees.

\param path the path to remove from the filesystem. \returns true on success or false on failure; call SDL_GetError() for more information.

\since This function is available since SDL 3.1.3.

extern SDL_DECLSPEC bool SDLCALL SDL_RemovePath(const char *path)

Implementation

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