empezar
10th October 2013 11:27 UTC
Change the installer size
Hi!
I've made an online installer using NSIS. I calculate what should be installed during the installation. However, when I select destination folder, the installation size is all wrong. I have the correct size in a variable - how do I change the installer size in the destination folder window?
Can I create a custom destination folder window?
bnicer
10th October 2013 14:17 UTC
I use code similar to this, which you might have to tweak in some places to make it work for you.
SRCDIR
>Var SIZE
Section"InstallFiles" id1
SetOutPath "-"
File "${SRCDIR}\*.*"
>SectionEnd
>; False section
Section"New_Size" id2
SectionEnd
>!define SetSize "Call SetSize"
>Function SetSize
StrCpy $SIZE"6474381" # ; size in bytes
; bytes to kilobytes
IntOp$0 $SIZE % 1024
IntOp $SIZE $SIZE/ 1024 ; rounded down
IntCmp$0 512 0 +2 0
IntOp $SIZE $SIZE+ 1 ; rounded up
SectionSetSize${id1} 0 ; clear size estimate
SectionSetSize${id2} $SIZE ; reset the size
FunctionEnd
>; Directory Page
>Function DirectoryPageShow
SectionGetSize${id2} $2
; Required space (reset)
${if} $
2 == 0
${SetSize}
${EndIf}
SectionSetSize ${id2} $SIZE
FunctionEnd
>
Originally posted by empezar
Can I create a custom destination folder window?
Why not? The NSIS directory page is pretty good though.
empezar
10th October 2013 18:11 UTC
Thank you! It worked fine.