Fix it properly

This commit is contained in:
tzugen 2022-10-04 11:21:25 +02:00
parent 7505166283
commit ec49fae666
No known key found for this signature in database
GPG Key ID: 61E9C34BC10EC930

View File

@ -1,6 +1,6 @@
/* /*
* StorageFile.kt * StorageFile.kt
* Copyright (C) 2009-2021 Ultrasonic developers * Copyright (C) 2009-2022 Ultrasonic developers
* *
* Distributed under terms of the GNU GPLv3 license. * Distributed under terms of the GNU GPLv3 license.
*/ */
@ -87,12 +87,10 @@ class StorageFile(
override fun getFileOutputStream(append: Boolean): OutputStream { override fun getFileOutputStream(append: Boolean): OutputStream {
val mode = if (append) "wa" else "w" val mode = if (append) "wa" else "w"
val descriptor = UApp.applicationContext().contentResolver.openAssetFileDescriptor( return UApp.applicationContext().contentResolver.openOutputStream(
uri, uri,
mode mode
) ) ?: throw IOException("Couldn't retrieve OutputStream")
return descriptor?.createOutputStream()
?: throw IOException("Couldn't retrieve OutputStream")
} }
override fun getFileInputStream(): InputStream { override fun getFileInputStream(): InputStream {