Page 1 of 1

Validating a typed in path

Posted: Fri Jun 29, 2007 7:20 pm
by Ryan Lee
Hello,

I have a dialog with a push button and a edit box. The edit box is populated with a variable that is initially set to the default installation directory. When the button is pushed, I perform a select custom folder and change the value in the edit box to whatever directory the user selected. The edit box is enabled so the user can type in the directory without having to use the folder selector.

Is it possible to validate the contents of the dialog to make sure the typed in path is valid? When dealing with Wix this is possible by specifying the CheckTargetPath control event. Is anything like this possible with InstallAware?

Thanks in advance for any help.

Posted: Sat Jun 30, 2007 6:53 am
by jimo
Try:

Code: Select all

Set Variable CHECKFOLDER to FALSE
Set Variable USERFOLDERCHOICE to $TARGETDIR$
label: Destination Directory
Display Dialog: destination, wait for dialog to return (modal)
if Variable WIZARD Equals BACK
   GoTo Label: <Previoous>
else
  if Variable WIZARD Equals CANCEL
    GoTo Label: Main Install
  end
end
Does Folder Exist $USERFOLDERCHOICE$ (get result into variable CHECKFOLDER)
If Variable CHECKFOLDER Equals FALSE
     GoTo Label: Destination Directory
end

Posted: Tue Jul 03, 2007 4:16 pm
by Ryan Lee
Thanks for the response. Unfortunately, the user is able to type in a folder that doesn't currently exist. The directory may be created at a later point in the installation. The File/Folder Exist command will probably be insufficient. Is there some way to see if the types in directory is valid (eg: doesn't contain invalid characters, valid disk drive, etc) ??

Thanks,
Ryan

Posted: Thu Jul 12, 2007 9:40 pm
by seanc
Is there a way to access the Remaining Space value that is returned from the Browse folder code?

If you put in an invalid TARGETDIR the RemainingSpace text box will show a negative value.

That is the value that Ryan & I are trying to catch to display an error like:
Invalid Destination Directory

Creating the directory is not what should be done because it is just another thing to be cleaned up.