make sure we are opening a valid path
This commit is contained in:
parent
0187fb3c03
commit
534a64c2f3
1 changed files with 9 additions and 1 deletions
|
@ -96,7 +96,15 @@ class MainActivity : SimpleActivity() {
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun openPath(path: String) {
|
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()
|
invalidateOptionsMenu()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue