DatL4g / Sekret

🔒 Deeply hide secrets with Kotlin Multiplatform
Apache License 2.0
41 stars 0 forks source link

How to get path parameter of NativeLoader.loadLibrary()? #1

Closed ezmi234 closed 9 months ago

ezmi234 commented 10 months ago

Hi, i'm not able to give the path parameter to load library function. I've tried to manage it in this way:

 val binaryLoaded = NativeLoader.loadLibrary("sekret", System.getProperty("compose.application.resources.dir")?.let { File(it) })

unfortunatly is not workking, do you have any sugggestions?

DatL4g commented 10 months ago

Take a look at this full example: https://github.com/DatL4g/Burning-Series/tree/compose/app/shared

You have to copy the built native library in the right directory, here is an full example for android and desktop (using compose) https://github.com/DatL4g/Burning-Series/blob/compose/app/shared/build.gradle.kts#L174-L283 I think you can copy it as is if you have the same folder structure.

For example the above method builts the sekret library in the shared module and then copies it to the platform related desktop https://github.com/DatL4g/Burning-Series/tree/compose/app/desktop/resources

You have to make sure to load this resources to the compose desktop app then https://github.com/DatL4g/Burning-Series/blob/compose/app/desktop/build.gradle.kts#L56

It's a bit complicated right now, I'll improve this soon, had a release phase until now, so it's development was paused.

If you've done everything correctly it should work with your code above

DatL4g commented 9 months ago

Version 0.4.0 simplifies this, take a look in the README: https://github.com/DatL4g/Sekret#android-or-desktop-compose