try removing temp folder only if the path isnt empty

This commit is contained in:
tibbi 2017-12-24 14:08:04 +01:00
parent 4e530d0517
commit 6c7e406dad

View file

@ -209,13 +209,15 @@ class MainActivity : SimpleActivity(), DirectoryAdapter.DirOperationsListener {
}
private fun removeTempFolder() {
val newFolder = File(config.tempFolderPath)
if (newFolder.exists() && newFolder.isDirectory) {
if (newFolder.list()?.isEmpty() == true) {
deleteFile(newFolder, true)
if (config.tempFolderPath.isNotEmpty()) {
val newFolder = File(config.tempFolderPath)
if (newFolder.exists() && newFolder.isDirectory) {
if (newFolder.list()?.isEmpty() == true) {
deleteFile(newFolder, true)
}
}
config.tempFolderPath = ""
}
config.tempFolderPath = ""
}
private fun tryloadGallery() {