Get path in wpSelectDir before {app} is installed by Inno Setup
I would like to get the path to the installation directory when the user clicks Next when I am in wpSelectDir
Inno Setup.
I need to validate the path because I need to validate the path, and if it isn't, I won't let the user continue.
My problem is that the constant {app}
hasn't been set yet, because it will be set after wpSelectDir
and I'm still at it.
source to share
Use WizardDirValue
support function :
Returns the current content of the edit control on the Select Destination page of the wizard.
In contrast
ExpandConstant('{app}')
, this function will not fail if called after showing the wizard, but before the user selects a directory. Rather, it will return the default directory name.
This is more idiomatic than WizardForm.DirEdit.Text
.
Though internally it does almost the same thing:
RemoveBackslashUnlessRoot(WizardForm.DirEdit.Text)
See also How to find user-selected installation path in Inno Setup?
source to share
You can do something like this ...
procedure onDirChange(Sender: TObject);
var
currentDir: String;
begin
currentDir := WizardForm.DirEdit.Text;
// your validation goes here....
end;
procedure InitializeWizard;
begin
WizardForm.DirEdit.onChange := @onDirChange;
end;
WizardForm.DirEdit.Text
returns the current value in the text box DirEdit
. The procedure onDirChange
is called every time the text in the dirEdit text box changes. You can use this value to perform your own checks.
source to share