Archive: Problem aborting page


Problem aborting page
Hi all,

I have a page as below:

Page EnterCustom LeaveCustom


And the EnterCustom function:


Function EnterCustom
File /oname=$PLUGINSDIR\installer.ini "@CMAKE_CURRENT_SOURCE_DIR@\installer\installer.ini"

StrCpy $0 "$PLUGINSDIR\installer.ini"

Call CreateDialogFromINI
FunctionEnd


The Installer.ini features a DirRequest as the 3rd field:


[Field 3]
Type=DirRequest
Left=10
Right=-10
Top=32
Bottom=44
Text=Select directory:
State=


And the LeaveCustom function:


Function LeaveCustome
Call UpdateINIState

ReadINIStr $Dir1 "$PLUGINSDIR\installer.ini" "Field 3" "State"

FindFirst $0 $1 "$Dir1\*.jpg"
StrCmp $1 "" 0 AllGood
MessageBox MB_OK|MB_ICONEXCLAMATION "The directory is not valid. Please try again."
Abort

AllGood:

FunctionEnd


As you see, after the user provides a directory (either by manually typing it or by selecting it using the '...' button), the scripts checks to make sure there are JPG files available in that directory. If not, it will prompt the user to enter another/valid directory.

Now the problem: If the user enters a valid directory the first time, it all works great. But if the user enters something invalid, let's say "qwerty", the error message is shown and the Abort happens, but the $Dir1 variable always keeps the 'qwerty' value even if users enters some other data afterwards. So if after the error message user types 'lkjh' in that box, $Dir1 still reads 'qwerty'. Also, if at this stage user presses the '...' button and chooses a directory, not only $Dir1 stays 'qwerty', but also even the text box on the screen stays 'qwerty'.

Can you please tell me what I am doing wrong? Thanks.

I found the mistake: because $0 was being clubbered everything was getting derailed.