forked from hardcoresushi/DroidFS
Allow directory creation on exposed volumes
This commit is contained in:
parent
5474d6eea5
commit
f4e47c1827
@ -236,14 +236,21 @@ class VolumeProvider: DocumentsProvider() {
|
||||
): String? {
|
||||
if (!usfExpose || !usfSafWrite) return null
|
||||
val document = parseDocumentId(parentDocumentId) ?: return null
|
||||
val newFile = PathUtils.pathJoin(document.path, displayName)
|
||||
val f = document.encryptedVolume.openFileWriteMode(newFile)
|
||||
return if (f == -1L) {
|
||||
Log.e(TAG, "Failed to create file: $document")
|
||||
null
|
||||
val path = PathUtils.pathJoin(document.path, displayName)
|
||||
var success = false
|
||||
if (mimeType == DocumentsContract.Document.MIME_TYPE_DIR) {
|
||||
success = document.encryptedVolume.mkdir(path)
|
||||
} else {
|
||||
val f = document.encryptedVolume.openFileWriteMode(path)
|
||||
if (f != -1L) {
|
||||
document.encryptedVolume.closeFile(f)
|
||||
document.rootId+newFile
|
||||
success = true
|
||||
}
|
||||
}
|
||||
return if (success) {
|
||||
document.rootId+path
|
||||
} else {
|
||||
null
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user