diff options
-rw-r--r-- | app/src/main/java/org/pacien/tincapp/storageprovider/FilesDocumentsProvider.kt | 9 |
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 | |||
37 | import java.io.File | 37 | import java.io.File |
38 | import java.io.FileNotFoundException | 38 | import java.io.FileNotFoundException |
39 | import kotlin.io.path.Path | 39 | import kotlin.io.path.Path |
40 | import kotlin.io.path.name | 40 | import kotlin.io.path.pathString |
41 | import kotlin.io.path.relativeTo | 41 | import kotlin.io.path.relativeTo |
42 | 42 | ||
43 | class FilesDocumentsProvider : DocumentsProvider() { | 43 | class 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 = |