Archive: Possible error in makensis,nsi


Possible error in makensis,nsi
  Hello. :)

I've been seeing this on my system for a while now (sorry I didn't point it out earlier. ;))

It appears to me that the .nsi and .nsh file types aren't registered if NSIS is being installed and these associations weren't already setup up by an older (pre beta4) NSIS installer.

Here's the relevant code (with extraneous bits snipped) from examples\makensis.nsi:

  ReadRegStr $R0 HKCR ".nsi" ""

StrCmp $R0 "NSISFile" 0 no_nsioldassoc
DeleteRegKey HKCR "NSISFile"
Goto nsi
no_nsioldassoc:

StrCmp $R0 "NSIS.Script" 0 no_nsi
nsi:
<
SNIP!>
no_nsiopen:
<SNIP!>
no_nsi:
Now say this is being run on a system where .nsi isn't registered to open with anything.

After the ReadRegStr, $R0 will contain "", and the comparison to NSISFile will fail so we branch to no_nsioldassoc. Now the comparison to NSIS.Script fails and we go to no_nsi. And we're done registering .nsi on this system. ;)

It seems odd to be checking for NSIS.Script before it's ever written (I guess you're trying to skip registering if it's already been done). But I'm not 100% certain what kinds of situations you're trying to account for so I'll have to leave the solution in your hands. For myself, I simply replaced the jump to no_nsioldassoc with a jump to nsi as a temporary workaround.


My thanks to all contributors to NSIS, it's an incredibly remarkable piece of software! :D

Thanks, fixed.