Unescaped DEFAULT_JVM_OPTS in application's launch script

It looks like the ‘application’ plugin uses the ScriptGenerator class in order to generate the launch scripts. Unfortunately this class decides to escape any sequences that contain the ‘$’ character, for example ‘$APP_HOME/media/griffon.icons’. The case in point is to generate appropriate entries for ‘-Xdock:name’ and ‘-Xdock:icon’ on OSX. The application’s icon resides in a directory locale to $APP_HOME.

The generate launch script contains

DEFAULT_JVM_ARGS=""-Xdock:icon=$APP_HOME/media/griffon.icns""

but it should be

DEFAULT_JVM_ARGS=""-Xdock:icon=$APP_HOME/media/griffon.icns""

Is there a way to avoid ‘$’ from being escaped at all?

1 Like

At the moment all ‘$’ signs are escaped. I’m not sure this is a best default here as referencing ‘$’ as variable is way more common as using the plain dollar sign.

I agree on escaping ‘$’ when dealing with Groovy scripts as that character has special meaning with GroovyStrings and variable interpolation, but that’s not the case with shell scripts, like the ones created by the ScriptGenerator class.

Could this behavior be configured in such a way that escaping ‘$’ is optional? If so I’ll pick no-escape as the default.

Cheers, Andres

(I was just about to report this as a problem myself.)

Yes, unconditionally escaping $ by StartScriptGenerator seems to not win. Referring to $APP_HOME is pretty much required in all but the simplest cases I think. Personally I’d prefer to deal with escaping stuff myself up in gradle land.