sdlGetAndroidExternalStoragePath function

String? sdlGetAndroidExternalStoragePath()

Get the path used for external storage for this Android application.

This path is unique to your application, but is public and can be written to by other applications.

Your external storage path is typically: /storage/sdcard0/Android/data/your.app.package/files.

This is a C wrapper over android.content.Context.getExternalFilesDir():

https://developer.android.com/reference/android/content/Context#getExternalFilesDir()

\returns the path used for external storage for this application on success or NULL on failure; call SDL_GetError() for more information.

\since This function is available since SDL 3.1.3.

\sa SDL_GetAndroidExternalStorageState \sa SDL_GetAndroidInternalStoragePath \sa SDL_GetAndroidCachePath

extern SDL_DECLSPEC const char * SDLCALL SDL_GetAndroidExternalStoragePath(void)

Implementation

String? sdlGetAndroidExternalStoragePath() {
  final sdlGetAndroidExternalStoragePathLookupFunction = libSdl3.lookupFunction<
      Pointer<Utf8> Function(),
      Pointer<Utf8> Function()>('SDL_GetAndroidExternalStoragePath');
  final result = sdlGetAndroidExternalStoragePathLookupFunction();
  if (result == nullptr) {
    return null;
  }
  return result.toDartString();
}