Skip to content

Commit

Permalink
Merge pull request #455 from mjaakko/delete_osmdroid_prefs
Browse files Browse the repository at this point in the history
Delete also OsmDroid preferences
  • Loading branch information
mjaakko authored Jan 27, 2025
2 parents cbe330b + 5dd1c3e commit 56a9b7a
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion app/src/main/java/xyz/malkki/neostumbler/StumblerApplication.kt
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ import xyz.malkki.neostumbler.db.ReportDatabase
import xyz.malkki.neostumbler.db.ReportDatabaseManager
import xyz.malkki.neostumbler.http.getCallFactory
import java.time.Duration
import kotlin.io.path.deleteIfExists
import kotlin.io.path.deleteRecursively
import kotlin.io.path.exists
import kotlin.properties.Delegates
Expand Down Expand Up @@ -167,12 +168,19 @@ class StumblerApplication : Application() {
* Deletes files used by Osmdroid library (no longer used by NeoStumbler)
*/
fun deleteOsmDroidFiles() {
val osmdroidDir = dataDir.toPath().resolve("files").resolve("osmdroid")
val dataDirPath = dataDir.toPath()

val osmdroidDir = dataDirPath.resolve("files").resolve("osmdroid")
if (osmdroidDir.exists()) {
Timber.d("Deleting OsmDroid files")
osmdroidDir.deleteRecursively()
}

val osmdroidPrefs = dataDirPath.resolve("shared_prefs").resolve("osmdroid.xml")
if (osmdroidPrefs.exists()) {
Timber.d("Deleting OsmDroid preferences")
osmdroidPrefs.deleteIfExists()
}
}

companion object {
Expand Down

0 comments on commit 56a9b7a

Please sign in to comment.