Jammer
Jammer

Reputation: 45

Path to uninstaller in Inno Setup

During install, the installer creates a backup directory with a timestamp added to make it unique if installer is started multiple times. During uninstall I need to process some files (not placed by [Files] and [Dir] section) to be restored in the usUninstall or usPostUninstall. These files are placed in sub-directories in the backup directory. For this, I need my location where the uninstaller is started so I can restore the files. I found and tried the GetCurrentDir function. But during uninstall the GetCurrentDir function returns the location c:\WINDOWS\system32. I tested it also during install, but in that case the GetCurrentDir function returns the location where the installer is started.

How to get the proper location from where the uninstall is started?

Upvotes: 1

Views: 767

Answers (1)

Martin Prikryl
Martin Prikryl

Reputation: 202272

The {uninstallexe} constant resolves to a path to the uninstaller.

If you combine that with ExtractFilePath, you get a path to the uninstaller folder:

ExtractFilePath(ExpandConstant('{uninstallexe}'))

Though actually, the path will typically be the installation path. So you can use {app} constant directly.


Do not use GetCurrentDir! It returns the current working directory. What does not have to be the path to the installer.

Use {src} constant.

Upvotes: 1

Related Questions