Clean up java.nio APIs usage to avoid desugaring

This commit is contained in:
FooIbar committed 2024-10-23 18:03:45 +08:00
1 parent 714d334067
commit c8cfaeecf6
2 files changed
+3 -4

No files matched your search

@@ -60,7 +60,6 @@ import io.ktor.utils.io.copyTo
import java.util.concurrent.locks.ReentrantReadWriteLock
import kotlin.concurrent.read
import kotlin.concurrent.write
import kotlin.io.path.readText
import kotlinx.coroutines.CancellationException
import okio.Path
@@ -254,7 +253,7 @@ class SpiderDen(val info: GalleryInfo) {
fun getExtension(index: Int): String? {
val key = getImageKey(gid, index)
return sCache.read(key) { metadata.toNioPath().readText() }
return sCache.read(key) { metadata.toFile().readText() }
?: findImageFile(index)?.name.let { FileUtils.getExtensionFromFilename(it) }
}
@@ -266,7 +265,7 @@ class SpiderDen(val info: GalleryInfo) {
return object : PathSource, AutoCloseable by snapshot {
override val source = snapshot.data
override val type by lazy {
snapshot.metadata.toNioPath().readText()
snapshot.metadata.toFile().readText()
}
}
}
+1 -1
View File
@@ -83,7 +83,7 @@ compose-destinations-compiler = { module = "io.github.raamcosta.compose-destinat
material-motion-core = "io.github.fornewid:material-motion-compose-core:2.0.1"
material-kolor = "com.materialkolor:material-kolor:2.0.0"
desugar = "com.android.tools:desugar_jdk_libs_nio:2.1.2"
desugar = "com.android.tools:desugar_jdk_libs:2.1.2"
diff = "io.github.petertrr:kotlin-multiplatform-diff:0.7.0"
jsoup = "org.jsoup:jsoup:1.18.1"