-
-
Notifications
You must be signed in to change notification settings - Fork 23.5k
Open
Description
Godot version
3.5.rc8
System information
Android 12
Issue description
When you call AudioStreamSample.save_to_wav(path), where path is in the system Music directory, it fails. Here's the log:
2022-08-05 12:30:00.472 3421-3538/org.godotengine.musicscopedstorage W/FileAccessHandler: Error while opening /storage/emulated/0/Music/MyApp/Song.wav
java.lang.IllegalArgumentException: Primary directory Music not allowed for content://media/external_primary/file; allowed directories are [Download, Documents]
at android.database.DatabaseUtils.readExceptionFromParcel(DatabaseUtils.java:172)
at android.database.DatabaseUtils.readExceptionFromParcel(DatabaseUtils.java:142)
at android.content.ContentProviderProxy.insert(ContentProviderNative.java:557)
at android.content.ContentResolver.insert(ContentResolver.java:2193)
at android.content.ContentResolver.insert(ContentResolver.java:2155)
at org.godotengine.godot.io.file.MediaStoreData$Companion.addFile(MediaStoreData.kt:169)
at org.godotengine.godot.io.file.MediaStoreData$Companion.access$addFile(MediaStoreData.kt:67)
at org.godotengine.godot.io.file.MediaStoreData.<init>(MediaStoreData.kt:257)
at org.godotengine.godot.io.file.DataAccess$Companion.generateDataAccess(DataAccess.kt:63)
at org.godotengine.godot.io.file.FileAccessHandler.fileOpen(FileAccessHandler.kt:106)
at org.godotengine.godot.GodotLib.step(Native Method)
at org.godotengine.godot.GodotRenderer.onDrawFrame(GodotRenderer.java:57)
at org.godotengine.godot.gl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1576)
at org.godotengine.godot.gl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1278)
However, if I save to the Downloads or Documents directories instead, it works.
One workaround I've found is to move the file to the Music directory with Directory.rename(from, to).
Edit: This fails with error 1 if from is in "user://", works if from is in OS.get_system_dir(OS.SYSTEM_DIR_DOWNLOADS).plus_file("MyApp")
Note: I haven't requested any permissions because I should be able to access shared folders by default.
Steps to reproduce
- Download MRP.
- Install to Android 10+ device.
- See log.
Minimal reproduction project
SuzukaDev