File tree Expand file tree Collapse file tree 1 file changed +14
-10
lines changed
core/src/jvmMain/kotlin/com/powersync Expand file tree Collapse file tree 1 file changed +14
-10
lines changed Original file line number Diff line number Diff line change 11package com.powersync
22
3+ import java.io.File
34import java.nio.file.Files
45import java.nio.file.Path
6+ import java.util.UUID
57import kotlin.io.path.Path
68import kotlin.io.path.absolutePathString
9+ import kotlin.uuid.Uuid
710
811private class R
912
@@ -24,21 +27,22 @@ internal fun extractLib(fileName: String): String {
2427 else -> error(" Unsupported architecture: $sysArch " )
2528 }
2629
27- val path = Files .createTempFile(Path (System .getProperty(" java.io.tmpdir" )), " $prefix$fileName " , extension)
28- val file =
29- path.toFile().apply {
30- setReadable(true )
31- setWritable(true )
32- setExecutable(true )
30+ val suffix = UUID .randomUUID().toString()
31+ val file = File (System .getProperty(" java.io.tmpdir" ), " $prefix$fileName -$suffix .$extension " ).apply {
32+ setReadable(true )
33+ setWritable(true )
34+ setExecutable(true )
35+
36+ deleteOnExit()
37+ }
3338
34- deleteOnExit()
35- }
3639
3740 val resourcePath = " /$prefix${fileName} _$arch .$extension "
3841
39- (R ::class .java.getResourceAsStream(resourcePath) ? : error(" Resource $path not found" )).use { input ->
42+ (R ::class .java.getResourceAsStream(resourcePath) ? : error(" Resource $resourcePath not found" )).use { input ->
4043 file.outputStream().use { output -> input.copyTo(output) }
4144 }
4245
43- return path.absolutePathString()
46+ println (" PowerSync loadable should be at $file " )
47+ return file.absolutePath
4448}
You can’t perform that action at this time.
0 commit comments