Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

JavaFX Self Installer With Inno Setup 5 - Allow user to change install directory

I am using Ant to build a self deploying EXE for a JavaFX application.

Currently Inno Setup places the EXE here: C:\Users\username\AppData\Local\application name

I would like to place this in a different location, and provide the user the option to override this. However I can't seem to find the ant settings to change this.

Is this possible?

Thanks!

like image 711
purring pigeon Avatar asked Feb 06 '15 16:02

purring pigeon


1 Answers

Actually you can't change this using ANT. However, as you already know the deploy mechanism uses Inno Setup and you can modify its behaviour.

During the fx:deploy ANT task a default ApplicationName.iss file is created. This default file contains e.g. the setting, which is responsible for the install directory. This default file is only created, if you don't provide any customized on your own. So, I would recommend to run the ANT script, copy the default file and modify it. If you enable the verbose flag of the fx:deploy task you can use the console output to find out, where the default file is created and where the ANT task searches for your customized file before creating the default one:

<fx:deploy
    ...
    verbose="true">

    <fx:info title="${appname}" vendor="${vendor}"/>
    ...
</fx:deploy>

In my case I found the default file in

C:\Users\gfkri\AppData\Local\Temp\fxbundler3627681647438085792\windows

and had to put the customized file to

package/windows/ApplicationName.iss

relative to the ANT build script.

If you got so far, you'll find the line DisableDirPage=Yes in your ApplicationName.iss file. Change it to DisableDirPage=No and the user gets the possibility to change the install directory.

Further you will find the parameter DefaultDirName. If you want to install your Application to C:\Program File\ApplicationName by default you can use the constant {pf} e.g.: DefaultDirName={pf}\ApplicationName.

like image 51
gfkri Avatar answered Oct 22 '22 09:10

gfkri