File tree Expand file tree Collapse file tree 3 files changed +19
-9
lines changed
core/src/jvmMain/kotlin/com/powersync Expand file tree Collapse file tree 3 files changed +19
-9
lines changed Original file line number Diff line number Diff line change 44
55* Added ` onChange ` method to the PowerSync client. This allows for observing table changes.
66* Removed unnecessary ` User-Id ` header from internal PowerSync service requests.
7+ * Fix loading native PowerSync extension for Java targets.
78
89## 1.0.0-BETA31
910
Original file line number Diff line number Diff line change 11package com.powersync
22
33import java.io.File
4+ import java.util.UUID
45
56private class R
67
@@ -21,14 +22,22 @@ internal fun extractLib(fileName: String): String {
2122 else -> error(" Unsupported architecture: $sysArch " )
2223 }
2324
24- val path = " /$prefix${fileName} _$arch .$extension "
25+ val suffix = UUID .randomUUID().toString()
26+ val file =
27+ File (System .getProperty(" java.io.tmpdir" ), " $prefix$fileName -$suffix .$extension " ).apply {
28+ setReadable(true )
29+ setWritable(true )
30+ setExecutable(true )
2531
26- val resourceURI =
27- (R ::class .java.getResource(path) ? : error(" Resource $path not found" ))
32+ deleteOnExit()
33+ }
34+
35+ val resourcePath = " /$prefix${fileName} _$arch .$extension "
36+
37+ (R ::class .java.getResourceAsStream(resourcePath) ? : error(" Resource $resourcePath not found" )).use { input ->
38+ file.outputStream().use { output -> input.copyTo(output) }
39+ }
2840
29- // Wrapping the above in a File handle resolves the URI to a path usable by SQLite.
30- // This is particularly relevant on Windows.
31- // On Windows [resourceURI.path] starts with a `/`, e.g. `/c:/...`. SQLite does not load this path correctly.
32- // The wrapping here transforms the path to `c:/...` which does load correctly.
33- return File (resourceURI.path).path.toString()
41+ println (" PowerSync loadable should be at $file " )
42+ return file.absolutePath
3443}
Original file line number Diff line number Diff line change @@ -17,7 +17,7 @@ development=true
1717RELEASE_SIGNING_ENABLED =true
1818# Library config
1919GROUP =com.powersync
20- LIBRARY_VERSION =1.0.0-BETA31
20+ LIBRARY_VERSION =1.0.0-BETA32
2121GITHUB_REPO =https://github.com/powersync-ja/powersync-kotlin.git
2222# POM
2323POM_URL =https://github.com/powersync-ja/powersync-kotlin/
You can’t perform that action at this time.
0 commit comments