To make the above description clearer, see the following code segment and example.
-- The original value of $INSTDIR is "C:\temp"
PageEx directory
DirVerify leave
PageCallbacks "" "" LeaveDirPage
PageExEnd
Function LeaveDirPage
...
FunctionEnd
-- Click "Browse" button, click a different folder "C:\abc", then click "Cancel" button to close the dir-browsing dialog.
-- Then, "C:\temp" remains in the edit box, however, now $INSTDIR = "C:\abc" if you check it in .onVerifyInstDir or LeaveDirPage function.
-- After LeaveDirPage runs, $INSTDIR is assigned to the original value (i.e., the one displayed in the edit box) "C:\temp".
-- Though NSIS will not install to a wrong dir, but LeaveDirPage cannot catch a correct one.
Do you think it is a BUG? Or did I misuse antything?