denys
denys

Reputation: 2529

InnoSetup How to determine custom dir path in uninstaller?

I'm creating custom dir in [Dirs] section. as defined below:

[Dirs]
Name: {code:WrkGetWorkingDir}; Flags: uninsalwaysuninstall

[Code]
function WrkGetWorkingDir( Param: String ): String;
begin
Result := WrkOptionsPage3.Values[0];
end;

In Uninstaller I want to determine somehow that dir path and use it to access some file inside it before it will be deleted. WrkGetWorkingDir call is failing in uninstaller. Is it possible to store that path in some magic InnoSetup variable (or section) or I should store it in Registry or my custom file?

Upvotes: 0

Views: 477

Answers (1)

Miral
Miral

Reputation: 13095

Yes. Read up on RegisterPreviousData, SetPreviousData, and GetPreviousData.

You may also want to have a look at the CodeDlg.iss example script and some examples on the wiki.

Another alternative is to have the uninstaller read it out of some file or registry setting already written at install time for your application to use.

Finally, however: you should be very careful about setting up deletes for user-entered paths (or indeed complete dir+file deletes for any path at all) -- some users may accidentally set this to somewhere unexpected that they don't actually want to have deleted.

Upvotes: 3

Related Questions