do not allow copying items in themselves

This commit is contained in:
tibbi
2016-11-05 20:27:19 +01:00
parent 5b79b025ce
commit 1de7985652
7 changed files with 11 additions and 0 deletions

View File

@ -49,6 +49,11 @@ class CopyDialog(val activity: Activity, val files: List<File>, val path: String
return@setOnClickListener
}
if (view.source.text.trimEnd('/') == destinationPath.trimEnd('/')) {
context.toast(R.string.source_and_destination_same)
return@setOnClickListener
}
val destinationDir = File(destinationPath)
if (!destinationDir.exists()) {
context.toast(R.string.invalid_destination)