Skip to content

Commit

Permalink
fix datastore crash
Browse files Browse the repository at this point in the history
  • Loading branch information
DatL4g committed May 30, 2024
1 parent cddcda7 commit dd7734d
Showing 1 changed file with 16 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ import dev.datlag.aniflow.other.BurningSeriesResolver
import dev.datlag.aniflow.other.Constants
import dev.datlag.aniflow.other.StateSaver
import dev.datlag.aniflow.settings.*
import dev.datlag.tooling.createAsFileSafely
import dev.datlag.tooling.existsRWSafely
import io.github.aakira.napier.Napier
import io.ktor.client.*
import io.ktor.client.engine.okhttp.*
Expand Down Expand Up @@ -97,7 +99,13 @@ actual object PlatformModule {
fileSystem = FileSystem.SYSTEM,
serializer = UserSettingsSerializer,
producePath = {
app.filesDir.toOkioPath().resolve("datastore").resolve("user.settings")
val path = app.filesDir.toOkioPath()
.resolve("datastore")
.resolve("user.settings").also {
it.toFile().createAsFileSafely()
}

path
}
)
)
Expand All @@ -109,7 +117,13 @@ actual object PlatformModule {
fileSystem = FileSystem.SYSTEM,
serializer = AppSettingsSerializer,
producePath = {
app.filesDir.toOkioPath().resolve("datastore").resolve("app.settings")
val path = app.filesDir.toOkioPath()
.resolve("datastore")
.resolve("app.settings").also {
it.toFile().createAsFileSafely()
}

path
}
)
)
Expand Down

0 comments on commit dd7734d

Please sign in to comment.