make sure we are opening a valid path

This commit is contained in:
tibbi 2017-10-23 14:17:04 +02:00
parent 0187fb3c03
commit 534a64c2f3

View file

@ -96,7 +96,15 @@ class MainActivity : SimpleActivity() {
}
private fun openPath(path: String) {
(fragment_holder as ItemsFragment).openPath(path)
var newPath = path
val file = File(path)
if (file.exists() && !file.isDirectory) {
newPath = file.parent
} else if (!file.exists()) {
newPath = internalStoragePath
}
(fragment_holder as ItemsFragment).openPath(newPath)
invalidateOptionsMenu()
}