FreeCol: FreeCol is a turn-based strategy game based on the old game Colonization, and similar to Civilization. The objective of the game is to create an independent nation.
GNU General Public License v2.0
585
stars
170
forks
source link
Modifications to support proper build of FreeCol as a Mac application bundle #62
Modifications to support proper build of FreeCol as a Mac application bundle.
Delete the old "FreeCol" executable
Add the universalJavaApplicationStub (from
https://github.com/tofi86/universalJavaApplicationStub). MIT licensed.
With the jarbundler ANT task, allows Java applications to be started with
whatever JDK/JRE is available on the system. Apple's solution won't work
for Java 1.8 and above.
Change build.xml to start up net.sf.freecol.FreeCol as the main class.
Added a property to the file so that the main class name stays consistent
between Mac app bundles and the manifest file for PC builds.
Without this, a user who unpacks the app bundle in /Applications and then clicks on the FreeCol icon will get a dialog saying that the bundle is damaged or cannot be executed. With these changes, it starts correctly. I've tested this on Mac OS 10.11, 10.14 and 10.15.
However, when a brand new FreeCol user starts up the app, it will close itself immediately with no error message displayed. This happens because the freecol per-user directory under ~/Library/Preferences hasn't been created. You can see this if you invoke the universalJavaApplicationStub directly; e.g.
calvin[bash]~ -> /Applications/FreeCol.app/Contents/MacOS/universalJavaApplicationStub
Bad user configuration directory: /Users/dpw/Library/Preferences/freecol
A workaround is to create it by hand:
mkdir ~/Library/Preferences/freecol
but the application really needs to create this directory for the user if it does not yet exist.
A similar subdirectory, ~/Library/Application Support/freecol, is created if it does not yet exist. Would it be possible to add code to create the subdirectory under Preferences in the same way?
Modifications to support proper build of FreeCol as a Mac application bundle.
Without this, a user who unpacks the app bundle in /Applications and then clicks on the FreeCol icon will get a dialog saying that the bundle is damaged or cannot be executed. With these changes, it starts correctly. I've tested this on Mac OS 10.11, 10.14 and 10.15.
However, when a brand new FreeCol user starts up the app, it will close itself immediately with no error message displayed. This happens because the freecol per-user directory under ~/Library/Preferences hasn't been created. You can see this if you invoke the universalJavaApplicationStub directly; e.g. calvin[bash]~ -> /Applications/FreeCol.app/Contents/MacOS/universalJavaApplicationStub Bad user configuration directory: /Users/dpw/Library/Preferences/freecol
A workaround is to create it by hand: mkdir ~/Library/Preferences/freecol but the application really needs to create this directory for the user if it does not yet exist.
A similar subdirectory, ~/Library/Application Support/freecol, is created if it does not yet exist. Would it be possible to add code to create the subdirectory under Preferences in the same way?