wurstscript / WurstScript

Programming language and toolkit to create Warcraft III Maps

Home Page:https://wurstlang.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Option to disable game path configuration

jmrico01 opened this issue · comments

Is your feature request related to a problem? Please describe.

Not sure if this should be a feature request or if it's already available. I'm using Wurst on macOS and it works great, except for the step where it looks for the game installation path. I get the following message:

Warning: Game path configuration only works on windows
Warning: Can't find game installation directory: java.lang.Exception: tried /Applications/Warcraft III/x86_64/Warcraft III.app/Contents/MacOS/Warcraft III and /Applications/Warcraft III/Warcraft III.app/Contents/MacOS/Warcraft III

Then, I'm prompted to select a path via a finder/file explorer popup, but I can't really provide a path that works (per the previous message, I guess this only works on Windows). I just have to pick a random path or cancel the popup, and the final .w3x map file builds just fine. However, the build ends with an error, which makes it hard to differentiate from legitimate build errors (especially for automated/CI builds).

Warning: No directory selected
java.lang.NullPointerException: Cannot invoke "java.io.File.toPath()" because "dir" is null
Error: Cannot invoke "java.io.File.toPath()" because "dir" is null
❌ There was an issue with the wurst build process.

This was me cancelling the popup. If I pick a path, the build actually hangs for a while.

Describe the solution you'd like

Not sure what the game path is for, but clearly I don't need it because the map builds just fine. I'd like an option to skip this step, or some way to avoid the build "failing" for this non-critical step. I couldn't find any build flags that would skip this.

Thanks for the report. The game path is only intended for 'runmap' to start the game, it shouldn't be used for the build task, so that's most likely a bug. Fixing configuration for macOS could also be done, I only tested on windows. Will take a look in a couple days.

Worth noting that I get some error logs before this, though I'm not sure if they are related. Again, the map is building just fine so clearly they aren't critical:

Error: Could not get encoding for /Users/patio/dev/impossible-bosses/./wurst/abilities/warlock/Malice.wurst
Error: Could not get encoding for /Users/patio/dev/impossible-bosses/./wurst/abilities/icemage/FreezingField.wurst
Error: Could not get encoding for /Users/patio/dev/impossible-bosses/./wurst/war3map.j
Error: Could not get encoding for /Users/patio/dev/impossible-bosses/./_build/dependencies/WurstStdlib2/wurst/data/LinkedList.wurst
java.nio.file.NoSuchFileException: /Users/patio/dev/impossible-bosses/./wurst/_build/dependencies
	at java.base/sun.nio.fs.UnixException.translateToIOException(UnixException.java:92)
	at java.base/sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:106)
	at java.base/sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:111)
	at java.base/sun.nio.fs.UnixFileSystemProvider.newDirectoryStream(UnixFileSystemProvider.java:461)
	at java.base/java.nio.file.Files.newDirectoryStream(Files.java:481)
	at java.base/java.nio.file.Files.list(Files.java:3772)
	at de.peeeq.wurstio.map.importer.ImportFile.getTransientImportDirectories(ImportFile.java:218)
	at de.peeeq.wurstio.map.importer.ImportFile.importFilesFromImports(ImportFile.java:191)
	at de.peeeq.wurstio.WurstCompilerJassImpl.runCompiletime(WurstCompilerJassImpl.java:131)
	at de.peeeq.wurstio.CompilationProcess.lambda$doCompilation$3(CompilationProcess.java:88)
	at de.peeeq.wurstio.TimeTaker.lambda$measure$0(TimeTaker.java:17)
	at de.peeeq.wurstio.TimeTaker$Default.measure(TimeTaker.java:35)
	at de.peeeq.wurstio.TimeTaker.measure(TimeTaker.java:16)
	at de.peeeq.wurstio.CompilationProcess.doCompilation(CompilationProcess.java:88)
	at de.peeeq.wurstio.Main.main(Main.java:155)

Okay, I looked into it. Game path configuration is actually also used for BuildMap to get the patch version, which is used for applying the map config. I adjusted it in 0f5c389 to only show the File Chooser for the RunMap task and fallback to 1.32 for other tasks if nothing is found/configured.
The encoding errors just mean your files have some charset encoding which can't be detected, and it falls back to UTF_8. I changed the detection library, but not sure if it will change anything.
Could look into supporting runmap on macOS in the future.

All fixed now, thank you!! Encoding errors also went away.