Skip to content

Commit

Permalink
fix provider creation
Browse files Browse the repository at this point in the history
  • Loading branch information
qimiko committed Jan 9, 2024
1 parent 0419e98 commit 2de883d
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions app/src/main/java/com/geode/launcher/UserDirectoryProvider.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down

0 comments on commit 2de883d

Please sign in to comment.