make sure we dont delete any folders from SD card accidentally
This commit is contained in:
parent
f9902873c6
commit
66f515199f
2 changed files with 9 additions and 2 deletions
|
@ -37,7 +37,7 @@
|
|||
<ConfirmationsSetting value="0" id="Add" />
|
||||
<ConfirmationsSetting value="0" id="Remove" />
|
||||
</component>
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_7" default="true" assert-keyword="true" jdk-15="true" project-jdk-name="1.8" project-jdk-type="JavaSDK">
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="true" assert-keyword="true" jdk-15="true" project-jdk-name="1.8" project-jdk-type="JavaSDK">
|
||||
<output url="file://$PROJECT_DIR$/build/classes" />
|
||||
</component>
|
||||
<component name="ProjectType">
|
||||
|
|
|
@ -40,7 +40,14 @@ class CopyMoveTask(val context: Context, val deleteAfterCopy: Boolean = false, v
|
|||
if (deleteAfterCopy) {
|
||||
for (file in mMovedFiles) {
|
||||
if (context.needsStupidWritePermissions(file.absolutePath)) {
|
||||
context.getFileDocument(file.absolutePath, treeUri).delete()
|
||||
val document = context.getFileDocument(file.absolutePath, treeUri)
|
||||
|
||||
// double check we have the uri to the proper file path, not some parent folder
|
||||
if (document.uri.toString().endsWith(file.absolutePath.getFilenameFromPath())) {
|
||||
Thread({
|
||||
document.delete()
|
||||
}).start()
|
||||
}
|
||||
} else {
|
||||
file.delete()
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue