Go Back   Winamp Forums > Developer Center > NSIS Discussion

Reply
Thread Tools Search this Thread Display Modes
Old 8th May 2007, 20:53   #1
martinm1000
Junior Member
 
Join Date: May 2007
Posts: 3
Question SetOverwrite scope

Hi,

I just started doing NSIS installer, and there is one thing that I cannot understand...

I have a custom window where I can select if I should do a new installation (SetOverwrite on) or an update (SetOverwrite off) for some files. This is working great.

But SetOverwrite on/off doesn't seems to be working always.

This doesnt work even if MessageBoxes confirm that the correct SetOverwrite was done:

code:

Section "!Section 1"
SetOutPath $INSTDIR
SetOverwrite on
; Recreate everything BUT web.config
File /a /r /x "web.config" "${SRCDIR}\*.*"
SectionEnd

Section "Section 2"
SetOutPath $INSTDIR

${If} $SETUP_MODE == "1"
SetOverwrite off ; Don't overwrite present files
${ElseIf} $SETUP_MODE == "0"
SetOverwrite on
${EndIf}

; This overwrite my file, even if I just wrote into it (INSTDIR)!
File "${SRCDIR}\web.config"
SectionEnd



It works if I do one of the folowing:

code:

${If} $SETUP_MODE == "1"
SetOverwrite off ; Don't overwrite present files
File "${SRCDIR}\web.config"
${ElseIf} $SETUP_MODE == "0"
SetOverwrite on
File "${SRCDIR}\web.config"
${EndIf}



Or it works (as it should) if I do this:

SetOverwrite off
File "${SRCDIR}\web.config"

--

So, What is the scope of SetOverwrite ???
martinm1000 is offline   Reply With Quote
Old 8th May 2007, 21:56   #2
martinm1000
Junior Member
 
Join Date: May 2007
Posts: 3
Angry

I'm still reading and trying many ways, but nothing I do work correctly... But as I was reading the manual, could all those problems be explained by the fact that SetOverwrite is a compiler flag and not an instruction ?

If so.... it kind of s*cks no ?
martinm1000 is offline   Reply With Quote
Old 9th May 2007, 14:32   #3
Comm@nder21
Major Dude
 
Join Date: Jul 2003
Location: germany, b-w
Posts: 734
Send a message via ICQ to Comm@nder21
yea, setoverwrite is interpreted by the compiler and thus the setting is hardwritten into the installer on compile time.

setoverwrite is not used on runtime so you can't use it to change the overwrite mode during installation.
Comm@nder21 is offline   Reply With Quote
Old 9th May 2007, 15:06   #4
martinm1000
Junior Member
 
Join Date: May 2007
Posts: 3
Thanks for the information. So there is no other way to set this overwrite at runtime ?

Hoping my other code constructs will still work ok !
martinm1000 is offline   Reply With Quote
Reply
Go Back   Winamp Forums > Developer Center > NSIS Discussion

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump