20. Rollback

## 20. Rollback

InstallBuilder installers include a rollback feature that automatically backs up any files overwritten during the installation and restores them if an error occurs during the installation process. The rollback functionality only handles files overwritten by the installer during the file installation step (i.e., all files specified under any `<folder>` section), and it does not support rolling back files overwritten as a result of the execution of actions or scripts.

The rollback feature is enabled by default but it can be disabled by setting the project property `<enableRollback>` to false:

    <project>
       ...
       <enableRollback>0</enableRollback>
       ...
    </project>

You can configure the directory where the overwritten files will be stored by setting the project property `<rollbackBackupDirectory>` (which defaults to an autoincremental `${installdir}/rollbackBackupDirectory`) to the desired path:

    <project>
       ...
       <rollbackBackupDirectory>${system_temp_directory}/backup</rollbackBackupDirectory>
       ...
    </project>

The files will be automatically restored in the event that the installation aborts. The rollbackBackupDirectory folder will not be removed after a successful installation, so it can also be manually accessed and restored. It will, however, be automatically cleaned up after a successful restoration following a failed installation attempt (only those files that could not be restored will remain in the rollback backup directory). If no files were backed up as a result of the rollback process, the empty rollbackBackupDirectory folder will be automatically deleted after installation.

If you specifically do not want the rollbackBackupDirectory folder to remain on the disk after a successful installation, you can delete it during the <postInstallationActionList> using a <deleteFile> action:

    <project>
       ...
       <rollbackBackupDirectory>${system_temp_directory}/backup</rollbackBackupDirectory>
       ...
       <postInstallationActionList>
          <deleteFile path="${project.rollbackBackupDirectory}"/>
       </postInstallationActionList>
       ...
    </project>

19. Regular expressions |  | 21. Troubleshooting