yairm210 / Unciv

Open-source Android/Desktop remake of Civ V
Mozilla Public License 2.0
8.26k stars 1.55k forks source link

Mods support on MacOS #2200

Closed Naprogramuji closed 4 years ago

Naprogramuji commented 4 years ago

Mods not showing when creating new game on MacOS. JAR version. Mods are unzipped and properly placed in "mods" folder alongside "Unciv.jar". Even newest ExampleIncaMod not working on latest game build (I tried compile own version as well).

rh-github-2015 commented 4 years ago

I had the Incas working. Did you compile including Pull #2191 and look at the console output? Is your Inca mod really the fixed one? Nations.json not in a 'Nations' subfolder? All property names quoted? Specifically, does it have a line '"unique":"GREAT_ANDEAN_ROAD"' - not unique: "long story"?

If you want, you can compare with my work in progress (actual implementation of the uniques mostly done, publication still pending): Inca-Mod.zip

Naprogramuji commented 4 years ago

Hm. I was build new version and magically works.

Naprogramuji commented 4 years ago

So another isssue:

Tomas-Triska-MacBook-Pro:unciv TomasTriska$ java -jar Unciv.jar Exception in thread "main" java.lang.RuntimeException: Error packing images. at com.badlogic.gdx.tools.texturepacker.TexturePacker.process(TexturePacker.java:657) at com.badlogic.gdx.tools.texturepacker.TexturePacker.process(TexturePacker.java:644) at com.unciv.app.desktop.DesktopLauncher.packImages(DesktopLauncher.kt:64) at com.unciv.app.desktop.DesktopLauncher.main(DesktopLauncher.kt:22) Caused by: java.lang.IllegalArgumentException: Input file does not exist: /Applications/Unciv/mods/.DS_Store/Images at com.badlogic.gdx.tools.FileProcessor.process(FileProcessor.java:118) at com.badlogic.gdx.tools.texturepacker.TexturePackerFileProcessor.process(TexturePackerFileProcessor.java:84) at com.badlogic.gdx.tools.texturepacker.TexturePacker.process(TexturePacker.java:655) ... 3 more Tomas-Triska-MacBook-Pro:unciv TomasTriska$

rh-github-2015 commented 4 years ago

"Input file does not exist: /Applications/Unciv/mods/.DS_Store/Images" .DS_Store is MacOS evilness (even worse than windoze thumbs.db) and has no business disturbing Unciv's folder handling.

In other words, you fed it a mod named ".DS_Store" with of course broken content.

That said, we could maybe code an exception for subfolder names beginning with a dot. My developer IDE is currenty broken, however.

Naprogramuji commented 4 years ago

Yeah. It can be potential problem with another hidden folders like .git or .vscode etc. It is not evilness. It is based on Unix file system. I think ZIP support for mods can help as well.

rh-github-2015 commented 4 years ago

No. ".DS_Store" is macos specific, no other *nix does those. Plus unlike .git they're created everywhere without your consent. Just take a look at a simple duckduckgo query and the picture is clear.

Now let's look at the code... Wait, what version are you on? Current code catches all exceptions happening inside mod load, logs them (since 3.6.9 or commit #2191, before it discarded them silently), and moves on to the next folder. Shouldn't be happening as you describe with current versions. Now your log shows an exception in packImages, which seems to me happens later, but only if the first load (the one described above) succeeds, and for that a subfolder 'jsons' must exist, which macos has no reason to create under .DS_Store - or did it? Anyways. I'll code a catch for packImages and a hard exclusion of .* folder names.

yairm210 commented 4 years ago

If this works now, is the issue closable?

Naprogramuji commented 4 years ago

I tested it and new improvements work. I think we can close… Thank you @rh-github-2015