Modifier and Type | Method and Description |
---|---|
java.io.File |
getInstallerFile()
Returns the current media file.
|
java.lang.String |
getMediaName()
Get the name of the current media file.
|
void |
installDirectory(java.io.File directory,
UninstallMode uninstallMode)
Creates a directory.
|
boolean |
installFile(java.io.File sourceFile,
java.io.File destFile)
Installs a file.
|
boolean |
installFile(java.io.File sourceFile,
java.io.File destFile,
FileOptions options)
Installs a file.
|
boolean |
installFile(java.io.File sourceFile,
java.io.File destFile,
FileOptions options,
ProgressInterface progressInterface,
int fromPercent,
int toPercent)
Installs a file.
|
boolean |
isUpdateInstallation()
Returns whether the installer is or will be updating an existing version of the same program.
|
void |
registerUninstallFile(java.io.File file)
Registers an arbitrary file for uninstallation.
|
void |
setInstallationDirectory(java.io.File installationDirectory)
Set the installation directory programmatically.
|
addInstallerEventListener, addToClassPath, finish, getActionById, getActions, getActions, getAddOnApplicationId, getApplicationId, getBooleanVariable, getCompilerVariable, getContentDirectory, getDefaultInstallationDirectory, getDestinationFile, getDestinationFile, getDestinationFileInfo, getExternalFile, getExternalFile, getExtraCommandLineArguments, getFileSetById, getFileSetByName, getFileSets, getFirstAction, getFirstScreen, getInstallationComponentById, getInstallationComponents, getInstallationDirectory, getLanguageId, getLauncherById, getLaunchers, getMediaFileId, getMessage, getMessage, getProgressInterface, getResourceDirectory, getScreenById, getScreens, getScreens, getVariable, getVariableNames, getVersion, getWizardContext, goBack, goBackInHistory, goBackInHistory, goForward, gotoScreen, handleCriticalException, hasBeenElevated, initializeLazilyCreatedScreens, isCancelling, isConsole, isErrorOccurred, isRebootRequired, isUnattended, registerHiddenVariable, registerResponseFileVariable, removeInstallerEventListener, runElevated, runScript, runUnelevated, setErrorOccurred, setVariable, triggerReboot, unregisterResponseFileVariable
void setInstallationDirectory(java.io.File installationDirectory)
Context.getInstallationDirectory()
and subsequently call setInstallationDirectory with the user selection. To change the default installation directory,
you could call this method from a "Run script" action that is added to the "Startup" screen.installationDirectory
- the new installation directoryboolean isUpdateInstallation()
ApplicationRegistry.isUpdateDirectory(java.io.File)
returns true for the currently set installation directory (Context.getInstallationDirectory()
.java.io.File getInstallerFile()
java.lang.String getMediaName()
boolean installFile(java.io.File sourceFile, java.io.File destFile) throws UserCanceledException
installFile(File, File, FileOptions)
with new FileOptions(sourceFile.lastModified())
.
The uninstaller will uninstall a file that has been installed with this method. The overwrite mode
will be OverwriteMode.ALWAYS_ASK_EXCEPT_FOR_UPDATE and the uninstaller mode
UninstallMode.IF_CREATED.sourceFile
- the file to be installed.destFile
- the destination file.UserCanceledException
- if the user cancels the installation.boolean installFile(java.io.File sourceFile, java.io.File destFile, FileOptions options) throws UserCanceledException
installFile(File, File, FileOptions, ProgressInterface, int, int)
with a ProgressInterface of null. The
FileOptions parameter determines the overwrite and uninstall modes.sourceFile
- the file to be installed.destFile
- the destination file.options
- the installation and uninstallation options.UserCanceledException
- if the user cancels the installation.boolean installFile(java.io.File sourceFile, java.io.File destFile, FileOptions options, ProgressInterface progressInterface, int fromPercent, int toPercent) throws UserCanceledException
Note that the progress bar is only available if this method is called from an action and the action is associated with a screen that offers a progress interface with a progress bar, such as the "Installation" screen or the customizable "Display progress" screen.
sourceFile
- the file to be installed.destFile
- the destination file.options
- the installation and uninstallation options.progressInterface
- the interface for displaying progress during the file installation.
The current progress interface can be obtained from Context.getProgressInterface()
.fromPercent
- the start percentage value for the file installation. The progress interface
will be advanced starting with this percentage value.toPercent
- the end percentage value for the file installation. The progress interface
will be advanced up to this percentage value.UserCanceledException
- if the user cancels the installation.void installDirectory(java.io.File directory, UninstallMode uninstallMode)
directory
- the directory to be created. All parent directories will be created if necessary.uninstallMode
- the behavior for uninstallation. It is recommended to use UninstallMode.IF_CREATED
by default.void registerUninstallFile(java.io.File file)
file
- the file that should be removed when uninstalling the application.