I’ve been working on a desktop compose app for a w...
# compose-desktop
s
I’ve been working on a desktop compose app for a while, and I just tried compiling it to a osx DMG today. When I try and run the app, it just hops up and down and then closes. I have some folders that almost definitely aren’t being packed into the DMG. Two questions: 1. What’s the best way to get output or logs from a compiled Desktop application? 2. How do I pack additional asset folders into the executable?
1
r
On macOS you should find the logs in the Console system app
o
@alexey.tsvetkov wdyt about assets?
a
Currently we only support resources packed into jar files. Open a request at https://github.com/JetBrains/compose-jb/issues Ideally, with examples of how you would like to pack and use resources.
@romainguy I’m actually not seeing the logs in the console app. I see lots of other apps.
Actually - I found it in the system log file. All it’s giving me is
(<http://application.com|application.com>.your.application.69737319.69737409[42608]): Service exited with abnormal code: 1
n
@spierce7 Try the Gradle :runDistributable task and you should get the native distribution’s output logs in the IntelliJ console
👍 1
As far as accessing other files — I used a workaround with
Thread.currentThread().contextClassLoader.getResource("some asset or resource file I know is in src/main/resources")
to get the directory of my JAR, opened that Jar as a
JarFile
and iterated through its
entries()
to open an InputStream to each resource with
Thread.currentThread().contextClassLoader.getResourceAsStream("")
. I copied from the InputStream into a folder that would end up at
~/Applications/my-app.app/Contents/Resources/
and then I just reference that as my new file root from wherever I need to do File I/O throughout the application. Would be nice if we had something on a Gradle level that packaged this for us, hopefully the above feature request leads to that
s
@Nik Thank you… the
runDistributable
task is exactly what I needed. The issue is that the files aren’t found.
🙌 1
n
@spierce7 Another workaround I had for this — creates a writable copy of the DMG, copies your
src/main/resources
to the
Resources
folder, copies back to a read-only copy, may help as well