fix #264, properly handle notes synced to SD card files

This commit is contained in:
tibbi 2019-03-09 12:07:19 +01:00
parent 7b1e0a5ea0
commit b239c7c1a2

View File

@ -568,9 +568,11 @@ class MainActivity : SimpleActivity() {
if (needsStupidWritePermissions(path)) {
handleSAFDialog(path) {
var document = getDocumentFile(File(path).parent) ?: return@handleSAFDialog
if (!File(path).exists()) {
document = document.createFile("", path.getFilenameFromPath())!!
val document = if (File(path).exists()) {
getDocumentFile(path) ?: return@handleSAFDialog
} else {
val parent = getDocumentFile(File(path).parent) ?: return@handleSAFDialog
parent.createFile("", path.getFilenameFromPath())!!
}
contentResolver.openOutputStream(document.uri).apply {