mirror of
https://github.com/FossifyOrg/File-Manager.git
synced 2026-02-23 10:14:37 -05: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) {
|
||||
(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()
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user