How can i check if my app is placed in the applica...
# compose-desktop
a
How can i check if my app is placed in the applications folder? I need my app to be in the applications folder so that I know that deeplinks work.
I think I found it. This returns
true
when run from the apps folder
Copy code
fun isRunningFromApplicationsFolder(): Boolean {
    val path = File(URLDecoder.decode(App::class.java.protectionDomain.codeSource.location.path, "UTF-8"))
        .absolutePath
    return path.contains("/Applications/")
}
a
Yes, that’s what Claude told me 😉
Or
Copy code
ClassLoader.getSystemClassLoader().getResource(".")?.path
c
on MacOS? be aware there is also
/Users/<username>/Applications
I missed the
contains
a
wasnt able to move the app to the folder programmatically tho. i think i need sudo for that
a
and it’s probably a special command to “install” it.
Typically users drag the app themselves to the Applications folder.
a
I've seen apps that move themselves for sure. electron has that option too (dont remember how it is done)