sdlJoystickPath function

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

Get the implementation dependent path of a joystick.

\param joystick the SDL_Joystick obtained from SDL_JoystickOpen() \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 2.24.0.

\sa SDL_JoystickPathForIndex

extern DECLSPEC const char *SDLCALL SDL_JoystickPath(SDL_Joystick *joystick)

Implementation

String? sdlJoystickPath(Pointer<SdlJoystick> joystick) {
  final sdlJoystickPathLookupFunction = libSdl2.lookupFunction<
      Pointer<Utf8> Function(Pointer<SdlJoystick> joystick),
      Pointer<Utf8> Function(
          Pointer<SdlJoystick> joystick)>('SDL_JoystickPath');
  final result = sdlJoystickPathLookupFunction(joystick);
  if (result == nullptr) {
    return null;
  }
  return result.toDartString();
}