Archive: saying $Instdir cannot be a certain folder?


saying $Instdir cannot be a certain folder?
  I haven't really researched this much, but is there any way to say "if $instdir = "C:\folder" then error/msgbox/don't install"?


Use .onVerifyInstDir.


all my stuff is at work, but this function allows me to do this?

Function .onVerifyInstDir
If $INSTDIR <> "\\path\directory" PathGood
Abort ;
PathGood
FunctionEnd

Yes. NSIS calls this function each time it gets a new installation directory selection. If you use Abort inside it the installation directory is deemed invalid. Use StrCmp to do the if of course.


haha, yes, i was just wondering how to do the "if" then I found "strcomp" in the makensis.htm file..thanks!

*edit* ok, last question I promise :) This should work, right?

Function .onVerifyInstDir
If strcmp $INSTDIR "\\path\directory" PathGood
Abort ;
PathGood
FunctionEnd

No, there is no if in NSIS, and ; is for comments.


onVerifyInstDir

StrCmp $INSTDIR"C:\\Bad dir" 0 PathGood
Abort
PathGood:
>FunctionEnd
>

cool, I wrote one up real quick. I see I had it backwards (and I knew about the semicolon, but was missing the colon to designate the section).

I think it works...great, thanks!


> but was missing the colon to designate the section

Label, not section ;)

> I think it works...great, thanks!

No problem, try reading the docs all the way next time please.


haha...yah, I knew posting that I should have read, but this was easier :D

thanks...