properly delete empty folders from SD card too

This commit is contained in:
tibbi 2017-09-01 12:21:31 +02:00
parent 01495680cb
commit 2a76929312
2 changed files with 2 additions and 2 deletions

View file

@ -299,7 +299,7 @@ class MediaActivity : SimpleActivity(), MediaAdapter.MediaOperationsListener {
private fun deleteDirectoryIfEmpty() { private fun deleteDirectoryIfEmpty() {
val file = File(mPath) val file = File(mPath)
if (config.deleteEmptyFolders && !file.isDownloadsFolder() && file.isDirectory && file.listFiles()?.isEmpty() == true) { if (config.deleteEmptyFolders && !file.isDownloadsFolder() && file.isDirectory && file.listFiles()?.isEmpty() == true) {
file.delete() deleteFile(file, true) {}
} }
} }

View file

@ -627,7 +627,7 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View
private fun deleteDirectoryIfEmpty() { private fun deleteDirectoryIfEmpty() {
val file = File(mDirectory) val file = File(mDirectory)
if (config.deleteEmptyFolders && !file.isDownloadsFolder() && file.isDirectory && file.listFiles()?.isEmpty() == true) { if (config.deleteEmptyFolders && !file.isDownloadsFolder() && file.isDirectory && file.listFiles()?.isEmpty() == true) {
file.delete() deleteFile(file, true) {}
} }
scanPath(mDirectory) {} scanPath(mDirectory) {}