adding some extra check to avoid deleting new nonempty folders

This commit is contained in:
tibbi 2019-07-28 19:17:01 +02:00
parent fa62914cb0
commit b1b173081a

View file

@ -389,7 +389,7 @@ class MainActivity : SimpleActivity(), DirectoryOperationsListener {
if (config.tempFolderPath.isNotEmpty()) { if (config.tempFolderPath.isNotEmpty()) {
val newFolder = File(config.tempFolderPath) val newFolder = File(config.tempFolderPath)
if (newFolder.exists() && newFolder.isDirectory) { if (newFolder.exists() && newFolder.isDirectory) {
if (newFolder.list()?.isEmpty() == true) { if (newFolder.list()?.isEmpty() == true && newFolder.getProperSize(true) == 0L && newFolder.getFileCount(true) == 0) {
toast(String.format(getString(R.string.deleting_folder), config.tempFolderPath), Toast.LENGTH_LONG) toast(String.format(getString(R.string.deleting_folder), config.tempFolderPath), Toast.LENGTH_LONG)
tryDeleteFileDirItem(newFolder.toFileDirItem(), true, true) tryDeleteFileDirItem(newFolder.toFileDirItem(), true, true)
} }