Change startscripts relative path from 'bin/' to something else

Hi there,

Is it possible to configure the start script’s relative path in CreateStartScripts task? Looking its code, it’s hard-coded to "bin/" + getUnixScript().getName() (see https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/java/org/gradle/jvm/application/tasks/CreateStartScripts.java#L272)

All I want to do is make it so that the scripts run from the root directory of the distribution or a different directory.

I extended CreateStartScripts to solve this:

apply plugin: 'distribution'

task createStartScripts(type: CreateStartScriptsInRoot) {
	description = "Creates the distribution's start scripts."
	group = 'distribution'
	applicationName = 'my-app'
	mainClassName = 'Main'
	outputDir = file("${buildDir}/scripts")
	classpath = jar.outputs.files + project.configurations.runtime
}

distributions {
	main {
		baseName = 'My Application'
		contents {
			into('lib') {
				from createStartScripts.classpath
			}
			from createStartScripts.outputDir
		}
	}
}

// Customizes Gradle's internal CreateStartScripts task
import org.gradle.api.internal.plugins.StartScriptGenerator
class CreateStartScriptsInRoot extends CreateStartScripts {
	@TaskAction
	void generate() {
		StartScriptGenerator generator = new StartScriptGenerator(unixStartScriptGenerator, windowsStartScriptGenerator)
		generator.setApplicationName(getApplicationName())
		generator.setMainClassName(getMainClassName())
		generator.setDefaultJvmOpts(getDefaultJvmOpts())
		generator.setOptsEnvironmentVar(getOptsEnvironmentVar())
		generator.setExitEnvironmentVar(getExitEnvironmentVar())
		generator.setClasspath(getRelativeClasspath())
		generator.setScriptRelPath(getUnixScript().getName()) // this is all that changed!
		generator.generateUnixScript(getUnixScript())
		generator.generateWindowsScript(getWindowsScript())
	}

	@Input
	private Iterable<String> getRelativeClasspath() {
		return CollectionUtils.collect(getClasspath().getFiles(), new Transformer<String, File>() {
			@Override
			String transform(File input) {
				return "lib/" + input.getName()
			}
		})
	}
}

Is this the best solution or is there something with the DSL that I can do?