sdlGetJoystickPathForId function

String? sdlGetJoystickPathForId(
  1. int instanceId
)

Get the implementation dependent path of a joystick.

This can be called before any joysticks are opened.

\param instance_id the joystick instance ID. \returns the path of the selected joystick. If no path can be found, this function returns NULL; call SDL_GetError() for more information.

\since This function is available since SDL 3.1.3.

\sa SDL_GetJoystickPath \sa SDL_GetJoysticks

extern SDL_DECLSPEC const char * SDLCALL SDL_GetJoystickPathForID(SDL_JoystickID instance_id)

Implementation

String? sdlGetJoystickPathForId(int instanceId) {
  final sdlGetJoystickPathForIdLookupFunction = libSdl3.lookupFunction<
      Pointer<Utf8> Function(Uint32 instanceId),
      Pointer<Utf8> Function(int instanceId)>('SDL_GetJoystickPathForID');
  final result = sdlGetJoystickPathForIdLookupFunction(instanceId);
  if (result == nullptr) {
    return null;
  }
  return result.toDartString();
}