Hi everyone, In a library, I need a reliable way, ...
# compose-desktop
u
Hi everyone, In a library, I need a reliable way, at runtime, to know whether the host application was started via classes on disk (
gradlew run
) or via packaged JAR (
gradlew runDistributable
). Does the Compose plugin expose any flag or API that I can check from within the library? Thanks!
f
That doesn't seem related to Compose itself. One way I know of is to inspect the URL of a resource from Class.getResource() - urls in jars look different. Note that if you are targeting multiplatform, it could be neither, so it's best if you don't depend on that.
p
Out of interest why do you need to do this ? Any easy workaround would be to have a script that passes an argument saying which mode it's running in.
u
This is for a library, using arguments is not an ideal solution at all Otherwise it is to send native notifications on macos with button actions, you have to go through UserNotifications framework, and for that you must have a correct bundle, I just want to check if the application is packaged to send the notification and avoid the crash.