sdlCreateDirectory function

bool sdlCreateDirectory(
  1. String? path
)

Create a directory, and any missing parent directories.

This reports success if path already exists as a directory.

If parent directories are missing, it will also create them. Note that if this fails, it will not remove any parent directories it already made.

\param path the path of the directory to create. \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_CreateDirectory(const char *path)

Implementation

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