mirror of
https://github.com/SimpleMobileTools/Simple-File-Manager.git
synced 2025-06-05 22:09:15 +02:00
make sure we are opening a valid path
This commit is contained in:
@ -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()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user