mirror of
https://github.com/FossifyOrg/File-Manager.git
synced 2026-11-05 12:32:53 -05:00
make sure we are opening a valid path
This commit is contained in:
1 parent
0187fb3c03
commit
534a64c2f3
1 file changed
+9
-1
@@ -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