I have an NSIS installer. I am working on the fact that I need to be able to prevent the installation of custom errors in folders (that is, $ SYSDIR, $ WINDIR, $ DESKTOP, etc.)
I want them to be able to choose the installation path, but just disable the next button if they choose the location indicated above. I searched everywhere and cannot find the answer to this question.
I tried to use this, but I can still install on the desktop:
...
Function MyDirLeave
Push $0
StrLen $0 $DESKTOP
StrCpy $0 $INSTDIR $0
StrCmp $0 $DESKTOP 0 proceed
MessageBox MB_ICONSTOP|MB_OK \
"Installation on DESKTOP is not allowed, choose another directory"
Abort
proceed:
Pop $0
FunctionEnd
source
share