try the new file deletion only if the old one fails
This commit is contained in:
parent
ea206806fc
commit
511f080d67
1 changed files with 10 additions and 10 deletions
|
@ -606,16 +606,6 @@ fun BaseSimpleActivity.deleteFile(fileDirItem: FileDirItem, allowDeleteFolder: B
|
|||
}
|
||||
|
||||
fun BaseSimpleActivity.deleteFileBg(fileDirItem: FileDirItem, allowDeleteFolder: Boolean = false, callback: ((wasSuccess: Boolean) -> Unit)? = null) {
|
||||
if (isRPlus()) {
|
||||
val fileUris = getFileUrisFromFileDirItems(arrayListOf(fileDirItem))
|
||||
deleteSDK30Uris(fileUris) { success ->
|
||||
runOnUiThread {
|
||||
callback?.invoke(success)
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
val path = fileDirItem.path
|
||||
val file = File(path)
|
||||
if (file.absolutePath.startsWith(internalStoragePath) && !file.canWrite()) {
|
||||
|
@ -639,6 +629,16 @@ fun BaseSimpleActivity.deleteFileBg(fileDirItem: FileDirItem, allowDeleteFolder:
|
|||
}
|
||||
}
|
||||
} else {
|
||||
if (isRPlus()) {
|
||||
val fileUris = getFileUrisFromFileDirItems(arrayListOf(fileDirItem))
|
||||
deleteSDK30Uris(fileUris) { success ->
|
||||
runOnUiThread {
|
||||
callback?.invoke(success)
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
if (getIsPathDirectory(file.absolutePath) && allowDeleteFolder) {
|
||||
fileDeleted = deleteRecursively(file)
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue