crotwell / gradle-macappbundle

A Gradle Plugin to create a Mac OSX .app application and dmg based on the project.
Apache License 2.0
96 stars 33 forks source link

is it possible to manually edit the startup script? #64

Closed akasolace closed 5 years ago

akasolace commented 5 years ago

Hello,

This is a question, i.e. I am not opening a new issue.

I am the new maintainer of an open source project The project consists of a main Java app and a a Java class. The way it works (so far only in windows) is from the main java app, the user can download a new version as a zip file. The launcher a bat file first launch the java class that unzip (if it exists) the zip file and then launch the main java app. Hence, the update process is transparent for the users. I would like now to distribute the same app for os x users and be able to keep the update functionality. Your graddle pluggin looks really interesting, but I don't see how I can amend manually the startup script. I am not even sure there is a startup script being generated with that process. Do you think this is feasible to achieve that? Thank you in advance for your help and or suggestions

crotwell commented 5 years ago

On the Mac, all the stuff that would be in a startup script is put into a "Info.plist" file and the dependency jar files end up in MyApp.app/Contents/Java/. So you could modify the Info.plist and the Contents/Java directory to accommodate new versions. There may be security issues with writing to those directories depending on how the application was installed.

Good luck.

akasolace commented 5 years ago

This time I think I know what is going on. On windows I have something like: /App/Ressources1/ /App/Ressources2/ /App/app.jar

I am using from my application files in Ressources1 and Ressources2 folder. Also I have some update mechanism that update files in those folders.

Once I bundle my app using macappbundle, my ressources folder got embedded into app.jar. Hence when I do thing like class.getressources, I end up with " jar:file:/pathto/XXX.app/Contents/Java/XX.jar!/sprache" when I was expecting " /pathto/XXX.app/Contents/Java/sprache"

This breaks lot of my code. Is it possible to have the ressources not part of the jar itself but as separate ressource folder?

thank you

crotwell commented 5 years ago

Sorry, no idea how to do that. When I have used resources in the past, I have always embedded them in a jar file.

akasolace commented 5 years ago

Actually, I found a workaround for that problem, but ideally I would still like to choose the working directory. On mac os X my app is creating some files in the user directory, it would be more appropriate to use the Application Folder. I could fix it by chaning a lot of relative path to absolute but I dont feel doing it this way so I am still investigating if it is possible to set working directory at global level. Any help would be very appreciated !!