fix: overwriting files on SD card

This commit is contained in:
darthpaul 2022-03-22 21:05:00 +00:00
parent beb62cf4b9
commit 2a3e684c19

View file

@ -1162,7 +1162,7 @@ fun BaseSimpleActivity.getFileOutputStreamSync(path: String, mimeType: String, p
} }
try { try {
val newDocument = documentFile.createFile(mimeType, path.getFilenameFromPath()) ?: getDocumentFile(path) val newDocument = getDocumentFile(path) ?: documentFile.createFile(mimeType, path.getFilenameFromPath())
applicationContext.contentResolver.openOutputStream(newDocument!!.uri) applicationContext.contentResolver.openOutputStream(newDocument!!.uri)
} catch (e: Exception) { } catch (e: Exception) {
showErrorToast(e) showErrorToast(e)