Archive: Replacing Duplicates in the script


Replacing Duplicates in the script
Hi,
I have a NSIS 1.98 script (havent had time to upgrade yet) that is a kind of patch system, I am wondering if anyone has achieved the following. Qhat i want to do is if a file has been superseded then dont include the previous one.

Eg
SetOutPath c:\

;patch from 1.0
file "c:\myfile.extn"
;patch from 1.1
file "c:\myfile.extn"
;patch from 1.2
file "c:\myotherfile.extn"
;patch from 1.3
file "c:\myfile.extn"

So in the compiled exe at the end it doesnt have three different versions of myfile.extn taking up space.

I know i can remove the File line for the previous version but this is a massive pain.... Any ideas anyone?


You could just use an !ifdef block over it.


!ifdef NOTHING
;patch from 1.0
file "c:\myfile.extn"
;patch from 1.1
file "c:\myfile.extn"
;patch from 1.2
file "c:\myotherfile.extn"
!endif
;patch from 1.3
file "c:\myfile.extn"


NOTHING will never be defined, so those File commands will never be used.
You'd just now need to move the last !endif down every time.

-Stu

Thanks Afrow UK for the reply,
Sorry im after something more runtime based(should have said that). What you have specified is what i am having to do now and its a pain, becasuse i have to have a version 1 to version 3 then a 1.1 to 3 then a 1.2 to 3


Basically if the target for a file is the same as a previous one remove the reference for the previous one.

As it compiles i would imageing it would create a list of instructions

like this
copy this file to outpath
copy that file to outpath
write this registry string

So the compiler would need to look back through this list and delete duplicates??!


From a look in the code something to do with build_entries looks like an array of installer commands