fix #163, remove invalid Favorites items on app startup
This commit is contained in:
parent
f69228be71
commit
e776be0b5a
|
@ -52,10 +52,10 @@ class MainActivity : SimpleActivity() {
|
||||||
|
|
||||||
if (savedInstanceState == null) {
|
if (savedInstanceState == null) {
|
||||||
tryInitFileManager()
|
tryInitFileManager()
|
||||||
|
checkWhatsNewDialog()
|
||||||
|
checkIfRootAvailable()
|
||||||
|
checkInvalidFavorites()
|
||||||
}
|
}
|
||||||
|
|
||||||
checkWhatsNewDialog()
|
|
||||||
checkIfRootAvailable()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onStop() {
|
override fun onStop() {
|
||||||
|
@ -285,6 +285,16 @@ class MainActivity : SimpleActivity() {
|
||||||
}.start()
|
}.start()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private fun checkInvalidFavorites() {
|
||||||
|
Thread {
|
||||||
|
config.favorites.forEach {
|
||||||
|
if (!it.startsWith(OTG_PATH) && !isPathOnSD(it) && !getDoesFilePathExist(it)) {
|
||||||
|
config.removeFavorite(it)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}.start()
|
||||||
|
}
|
||||||
|
|
||||||
fun pickedPath(path: String) {
|
fun pickedPath(path: String) {
|
||||||
val resultIntent = Intent()
|
val resultIntent = Intent()
|
||||||
val uri = getFilePublicUri(File(path), BuildConfig.APPLICATION_ID)
|
val uri = getFilePublicUri(File(path), BuildConfig.APPLICATION_ID)
|
||||||
|
|
Loading…
Reference in New Issue