aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--app/src/main/java/org/pacien/tincapp/storageprovider/FilesDocumentsProvider.kt9
1 files changed, 6 insertions, 3 deletions
diff --git a/app/src/main/java/org/pacien/tincapp/storageprovider/FilesDocumentsProvider.kt b/app/src/main/java/org/pacien/tincapp/storageprovider/FilesDocumentsProvider.kt
index 1e5fd6f..6af8b1b 100644
--- a/app/src/main/java/org/pacien/tincapp/storageprovider/FilesDocumentsProvider.kt
+++ b/app/src/main/java/org/pacien/tincapp/storageprovider/FilesDocumentsProvider.kt
@@ -37,7 +37,7 @@ import org.pacien.tincapp.utils.pathUnder
37import java.io.File 37import java.io.File
38import java.io.FileNotFoundException 38import java.io.FileNotFoundException
39import kotlin.io.path.Path 39import kotlin.io.path.Path
40import kotlin.io.path.name 40import kotlin.io.path.pathString
41import kotlin.io.path.relativeTo 41import kotlin.io.path.relativeTo
42 42
43class FilesDocumentsProvider : DocumentsProvider() { 43class FilesDocumentsProvider : DocumentsProvider() {
@@ -125,8 +125,11 @@ class FilesDocumentsProvider : DocumentsProvider() {
125 if (parentDocumentId != null) 125 if (parentDocumentId != null)
126 childPath = childPath.relativeTo(Path(parentDocumentId)) 126 childPath = childPath.relativeTo(Path(parentDocumentId))
127 127
128 val components = childPath.asSequence().map { it.name }.toList() 128 val subPaths = (1 .. childPath.nameCount).map {
129 return DocumentsContract.Path(ROOT_ID, listOf(ROOT_DOCUMENT_ID) + components) 129 childPath.subpath(0, it).pathString
130 }.toList()
131
132 return DocumentsContract.Path(ROOT_ID, listOf(ROOT_DOCUMENT_ID) + subPaths)
130 } 133 }
131 134
132 override fun isChildDocument(parentDocumentId: String?, documentId: String?): Boolean = 135 override fun isChildDocument(parentDocumentId: String?, documentId: String?): Boolean =