Archive: Problem with path valid


Problem with path valid
Hello!

I have a problem with vaidation of path. I use 'Modern UI' and I want to disable "Next" button if Destination Folder is empty or not exist.
I try to use .onVerifyInstDir function, but it doesn't work correctly.
For example, I wrote:

Function .onVerifyInstDir
StrCmp $INSTDIR "" 0 +2
Abort
FunctionEnd

and empty field didn't produce Next button disabled

May be, you know, what's a problem?


odd... ModernUI should already disable the Next button if the field is an empty string.

edit: whoops, totally misread that. ignore earlier sample code %)

Edit: here we go, new sample code:


!include "MUI.nsh"
!include "LogicLib.nsh"

Name "Modern UI Test"
OutFile "Basic.exe"

!insertmacro MUI_PAGE_DIRECTORY
!insertmacro MUI_PAGE_COMPONENTS
!insertmacro MUI_PAGE_INSTFILES

!insertmacro MUI_LANGUAGE "English"

Section "Dummy Section 1" SecDummy

SectionEnd

Function .onVerifyInstDir
IfFileExists "$INSTDIR\*.*" +2
Abort
FunctionEnd

I tried so, but the same was
May be it is from using MUI_DIRECTORYPAGE_TEXT_DESTINATION instead of MUI_PAGE_DIRECTORY in my code?

I have in my code:

; Directory page
;------------------------------
!verbose push
!verbose ${MUI_VERBOSE}
!insertmacro MUI_PAGE_INIT
!insertmacro MUI_SET MUI_${MUI_PAGE_UNINSTALLER_PREFIX}DIRECTORYPAGE
!insertmacro MUI_DEFAULT MUI_DIRECTORYPAGE_TEXT_TOP ""
!insertmacro MUI_DEFAULT MUI_DIRECTORYPAGE_TEXT_DESTINATION ""

PageEx ${MUI_PAGE_UNINSTALLER_FUNCPREFIX}directory
PageCallbacks MyFuncPre MyFuncShow MyFuncLeave
Caption " "
DirText "${MUI_DIRECTORYPAGE_TEXT_TOP}" "${MUI_DIRECTORYPAGE_TEXT_DESTINATION}"
DirVerify leave
PageExEnd

!undef MUI_DIRECTORYPAGE_TEXT_TOP
!undef MUI_DIRECTORYPAGE_TEXT_DESTINATION
!insertmacro MUI_UNSET MUI_DIRECTORYPAGE_VARIABLE
!insertmacro MUI_UNSET MUI_DIRECTORYPAGE_VERIFYONLEAVE
!verbose pop
;-------------------------------------


I understand something -
'DirVerify leave' parameter denied to involve the validation. It's necessarily to turn off it :)