This was copied from the dialog I had with ChatGPT and it seems to cure the problem of moving the file and renaming With or WITHOUT spaces in the nameI spent some time on ChatGPT and came up with this solution to the problem.
VASSAL Mac launcher fails when application path contains spaces or file is moved
VASSAL version: 3.7.29
Platform: macOS on MacBook Air
Problem: VASSAL will not launch if the application name or any parent directory in its path contains a space.
I have been using VASSAL on Mac computers for many years. This behavior appears to be new with the recent VASSAL versions. I first encountered it with the 3.8.0 beta versions, and it is also present in the current 3.7.29 release.
Reproduction
A newly downloaded VASSAL application will launch normally from:
/Applications/VASSAL.app
However:
-
Renaming the application to VASSAL copy.app causes it not to launch.
-
Renaming it to VASSALcopy.app (no space) allows it to launch from /Applications.
-
Moving VASSALcopy.app to:
/Applications/Vassal Apps/VASSALcopy.app
causes it not to launch because the parent directory contains a space.
4. Moving the application back to /Applications allows it to launch again.
5. I modified only one line in the launcher script, changing:
cd $path
to:
cd "$path"
After that change, VASSALcopy.app successfully launches from /Applications/Vassal Apps/.
Exact error
Running the launcher directly from Terminal before the modification produced:
/Applications/VASSAL copy.app/Contents/MacOS/VASSAL.sh: line 112: cd: /Applications/VASSAL: No such file or directory
followed by:
arch: Contents/MacOS/jre/bin/java isn't executable
The relevant portion of VASSAL.sh is:
path="$(dirname "$0")/../.."
and later:
cd $path
Because $path can contain spaces, the shell splits the pathname. Changing the latter to:
cd "$path"
fixes the problem.
Additional testing
I checked the code signature of both the working original application and the failing copy. Both returned:
code object is not signed at all
I also checked extended attributes with xattr -l; neither application had a com.apple.quarantine attribute.
The macOS system log showed the VASSAL process being launched and then exiting rather than being rejected by Gatekeeper.
Conclusion
This appears to be a bug in the Mac VASSAL.sh launcher: $path is quoted when it is created but is not quoted when passed to cd.
The one-line change:
cd $path
to:
cd "$path"
correctly handles application paths containing spaces.
I hope this can be corrected in the next release.