make sure we dont delete any folders from SD card accidentally

This commit is contained in:
tibbi 2017-01-16 20:11:34 +01:00
parent f9902873c6
commit 66f515199f
2 changed files with 9 additions and 2 deletions

View file

@ -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">

View file

@ -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()
}