Closed SultanArshad closed 3 weeks ago
Hi @SultanArshad Thanks for opening the issue. I think we should check if the file exists before deleting it, or just set mustDelete = false
Feel free to PR a fix in. Otherwise I can fix this over the weekend 👍
Fyi: Had tested the proposed fixed in local project works perfect.
Fixed in 0.9.1-SNAPSHOT
. Thanks for your contribution! 🙌
APP Crashes when call store.delete() function from the lib see logs. I think the recent update to the temp file system is causing this.
Expected work for the delete fun should be to delete the original file/store. Looks like the system is trying to find a file that is generate and deleted in the writing process.
java.io.FileNotFoundException: File does not exist: /data/user/0/au.com.gridstone.pscore.demo/files/devices.json.temp at kotlinx.io.files.FileSystemJvmKt$SystemFileSystem$1.delete(FileSystemJvm.kt:61) at kotlinx.io.files.FileSystem.delete$default(FileSystem.kt:50) at io.github.xxfast.kstore.file.FileCodec.encode(FileCodec.kt:68) at io.github.xxfast.kstore.KStore$write$2.invokeSuspend(KStore.kt:56) at io.github.xxfast.kstore.KStore$write$2.invoke(Unknown Source:8) at io.github.xxfast.kstore.KStore$write$2.invoke(Unknown Source:4) at kotlinx.coroutines.intrinsics.UndispatchedKt.startUndispatchedOrReturn(Undispatched.kt:42) at kotlinx.coroutines.BuildersKt__Builders_commonKt.withContext(Builders.common.kt:164) at kotlinx.coroutines.BuildersKt.withContext(Unknown Source:1) at io.github.xxfast.kstore.KStore.write(KStore.kt:55) at io.github.xxfast.kstore.KStore.set(KStore.kt:73) at au.com.gridstone.pscore.app.android.background.FirebaseCloudMessagingService$onNewToken$1.invokeSuspend(FirebaseCloudMessagingService.kt:65) at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33) at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:101) at kotlinx.coroutines.internal.LimitedDispatcher$Worker.run(LimitedDispatcher.kt:113) at kotlinx.coroutines.scheduling.TaskImpl.run(Tasks.kt:89) at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:589) at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:823) at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:720) at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:707) Suppressed: kotlinx.coroutines.internal.DiagnosticCoroutineContextException: [StandaloneCoroutine{Cancelling}@72ffb53, Dispatchers.IO]