File tree 3 files changed +19
-9
lines changed
core/src/jvmMain/kotlin/com/powersync
3 files changed +19
-9
lines changed Original file line number Diff line number Diff line change 4
4
5
5
* Added ` onChange ` method to the PowerSync client. This allows for observing table changes.
6
6
* Removed unnecessary ` User-Id ` header from internal PowerSync service requests.
7
+ * Fix loading native PowerSync extension for Java targets.
7
8
8
9
## 1.0.0-BETA31
9
10
Original file line number Diff line number Diff line change 1
1
package com.powersync
2
2
3
3
import java.io.File
4
+ import java.util.UUID
4
5
5
6
private class R
6
7
@@ -21,14 +22,22 @@ internal fun extractLib(fileName: String): String {
21
22
else -> error(" Unsupported architecture: $sysArch " )
22
23
}
23
24
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 )
25
31
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
+ }
28
40
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
34
43
}
Original file line number Diff line number Diff line change @@ -17,7 +17,7 @@ development=true
17
17
RELEASE_SIGNING_ENABLED =true
18
18
# Library config
19
19
GROUP =com.powersync
20
- LIBRARY_VERSION =1.0.0-BETA31
20
+ LIBRARY_VERSION =1.0.0-BETA32
21
21
GITHUB_REPO =https://github.com/powersync-ja/powersync-kotlin.git
22
22
# POM
23
23
POM_URL =https://github.com/powersync-ja/powersync-kotlin/
You can’t perform that action at this time.
0 commit comments