sdlGetPathInfo function filesystem

bool sdlGetPathInfo(
  1. String? path,
  2. Pointer<SdlPathInfo> info
)

Get information about a filesystem path.

Symlinks, on filesystems that support them, are always followed, so you will always get information on what the symlink eventually points to, and not the symlink itself.

\param path the path to query. \param info a pointer filled in with information about the path, or NULL to check for the existence of a file. \returns true on success or false if the file doesn't exist, or another failure; call SDL_GetError() for more information.

\threadsafety It is safe to call this function from any thread.

\since This function is available since SDL 3.2.0.

extern SDL_DECLSPEC bool SDLCALL SDL_GetPathInfo(const char *path, SDL_PathInfo *info)

Implementation

bool sdlGetPathInfo(String? path, Pointer<SdlPathInfo> info) {
  final sdlGetPathInfoLookupFunction = _libSdl
      .lookupFunction<
        Uint8 Function(Pointer<Utf8> path, Pointer<SdlPathInfo> info),
        int Function(Pointer<Utf8> path, Pointer<SdlPathInfo> info)
      >('SDL_GetPathInfo');
  final pathPointer = path != null ? path.toNativeUtf8() : nullptr;
  final result = sdlGetPathInfoLookupFunction(pathPointer, info) == 1;
  calloc.free(pathPointer);
  return result;
}