We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 7b1e0a5 commit b239c7cCopy full SHA for b239c7c
app/src/main/kotlin/com/simplemobiletools/notes/pro/activities/MainActivity.kt
@@ -568,9 +568,11 @@ class MainActivity : SimpleActivity() {
568
569
if (needsStupidWritePermissions(path)) {
570
handleSAFDialog(path) {
571
- var document = getDocumentFile(File(path).parent) ?: return@handleSAFDialog
572
- if (!File(path).exists()) {
573
- document = document.createFile("", path.getFilenameFromPath())!!
+ val document = if (File(path).exists()) {
+ getDocumentFile(path) ?: return@handleSAFDialog
+ } else {
574
+ val parent = getDocumentFile(File(path).parent) ?: return@handleSAFDialog
575
+ parent.createFile("", path.getFilenameFromPath())!!
576
}
577
578
contentResolver.openOutputStream(document.uri).apply {
0 commit comments