How can my app code access to the files added as `...
# multiplatform
a
How can my app code access to the files added as
src/commonMain/resources
from native executable built as
binaries.executable()
?
👀 2
b
I'd assume in the same way you'd access embedded resources in c (is that even possible?)
a
Do you mean, using C fucntions like
fopen()
? But I don't see my resources under
build/bin
etc. Is it bundled in
.kexe
?
b
No, fopen is for normal files only. I was wondering if c has some sort of flows for accessing embedded files. Something like jvm's loadResourceFromClasspath()
a
Yeah that would resolve the problem, if exists.
b
Not c though, since googling for c always gives results for c#...
a
lol
and I need cross-platform solution, not just Windows...
e
no, there's nothing like this for cross-platform C
😥 1
b
Then you could just copy processedResources into the binary directory and open them up via fopen
Essentially distributing them alongside your binary. Not ideal, but gets the job done.
e
the trick I've used is equivalent to https://csl.name/post/embedding-binary-data/
the codegen approach is doable without platform specifics but can cause the compiler to blow up with large artifacts
a
Well, yeah I don't think I'm going to hack kotlinc or klib to embed resources into .kexe. Copying resources to each build output directory would suffice. That seems an overlooked task at kotlin gradle plugin though.
b
Indeed. It's still fairly recently that they've fixed it for js. Might be worth raising an issue or a PR for native too.
a
yup, am looking at youtrack now. Thanks folks.
o
Any progress here ? 🤔
a
You should ask JetBrains devs via youtrack, maybe not those who submitted the issues?