sdlGetJoystickPath function joystick

String? sdlGetJoystickPath(
  1. Pointer<SdlJoystick> joystick
)

Get the implementation dependent path of a joystick.

\param joystick the SDL_Joystick obtained from SDL_OpenJoystick(). \returns the path of the selected joystick. If no path can be found, this function returns NULL; 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.

\sa SDL_GetJoystickPathForID

extern SDL_DECLSPEC const char * SDLCALL SDL_GetJoystickPath(SDL_Joystick *joystick)

Implementation

String? sdlGetJoystickPath(Pointer<SdlJoystick> joystick) {
  final sdlGetJoystickPathLookupFunction = _libSdl
      .lookupFunction<
        Pointer<Utf8> Function(Pointer<SdlJoystick> joystick),
        Pointer<Utf8> Function(Pointer<SdlJoystick> joystick)
      >('SDL_GetJoystickPath');
  final result = sdlGetJoystickPathLookupFunction(joystick);
  if (result == nullptr) {
    return null;
  }
  return result.toDartString();
}