Skip to content

Commit e776be0

Browse files
committed
fix #163, remove invalid Favorites items on app startup
1 parent f69228b commit e776be0

File tree

1 file changed

+13
-3
lines changed
  • app/src/main/kotlin/com/simplemobiletools/filemanager/activities

1 file changed

+13
-3
lines changed

app/src/main/kotlin/com/simplemobiletools/filemanager/activities/MainActivity.kt

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,10 +52,10 @@ class MainActivity : SimpleActivity() {
5252

5353
if (savedInstanceState == null) {
5454
tryInitFileManager()
55+
checkWhatsNewDialog()
56+
checkIfRootAvailable()
57+
checkInvalidFavorites()
5558
}
56-
57-
checkWhatsNewDialog()
58-
checkIfRootAvailable()
5959
}
6060

6161
override fun onStop() {
@@ -285,6 +285,16 @@ class MainActivity : SimpleActivity() {
285285
}.start()
286286
}
287287

288+
private fun checkInvalidFavorites() {
289+
Thread {
290+
config.favorites.forEach {
291+
if (!it.startsWith(OTG_PATH) && !isPathOnSD(it) && !getDoesFilePathExist(it)) {
292+
config.removeFavorite(it)
293+
}
294+
}
295+
}.start()
296+
}
297+
288298
fun pickedPath(path: String) {
289299
val resultIntent = Intent()
290300
val uri = getFilePublicUri(File(path), BuildConfig.APPLICATION_ID)

0 commit comments

Comments
 (0)