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)) { if (needsStupidWritePermissions(path)) {
handleSAFDialog(path) { handleSAFDialog(path) {
var document = getDocumentFile(File(path).parent) ?: return@handleSAFDialog val document = if (File(path).exists()) {
if (!File(path).exists()) { getDocumentFile(path) ?: return@handleSAFDialog
document = document.createFile("", path.getFilenameFromPath())!! } else {
val parent = getDocumentFile(File(path).parent) ?: return@handleSAFDialog
parent.createFile("", path.getFilenameFromPath())!!
} }
contentResolver.openOutputStream(document.uri).apply { contentResolver.openOutputStream(document.uri).apply {