From 2de883d100fa92d051c08ad2f9c3c8b271ba5a6c Mon Sep 17 00:00:00 2001 From: qimiko <25387744+qimiko@users.noreply.github.com> Date: Mon, 8 Jan 2024 23:31:21 -0700 Subject: [PATCH] fix provider creation --- .../com/geode/launcher/UserDirectoryProvider.kt | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/app/src/main/java/com/geode/launcher/UserDirectoryProvider.kt b/app/src/main/java/com/geode/launcher/UserDirectoryProvider.kt index 188bc6b3..2cc75f25 100644 --- a/app/src/main/java/com/geode/launcher/UserDirectoryProvider.kt +++ b/app/src/main/java/com/geode/launcher/UserDirectoryProvider.kt @@ -129,6 +129,22 @@ class UserDirectoryProvider : DocumentsProvider() { } } + override fun createDocument( + parentDocumentId: String, + mimeType: String, + displayName: String + ): String? { + val folder = getFileForDocumentId(parentDocumentId) + val file = findFileNameForNewFile(File(folder, displayName)) + if (mimeType == DocumentsContract.Document.MIME_TYPE_DIR) { + file.mkdirs() + } else { + file.createNewFile() + } + + return getDocumentIdForFile(file) + } + override fun deleteDocument(documentId: String) { val file = getFileForDocumentId(documentId) file.deleteRecursively()