Archive: AddSize


AddSize
I'm having a problem that is really working on my nerves for almost the whole day. I'm trying to use AddSize in a section together with a variable or a constant. So what I'm trying to do is something like this:
AddSize $R0

This is situated in a section and $R0 has an integer as value. If I replace $R0 with a value like 24352636, there's no problem.
So the problem is that AddSize doesn't seem to take variables as a parameter. Does somebody have a solution to this problem? thnx


AddSize is a copmile time command, so it can't use variables which only have values on runtime. To change the size of a section on runtime grab the latest CVS version and use SectionSetSize and SectionGetSize.


SetSectionSize 0 100 not working...
Doesn't seem to work like AddSize does?....


Quick answer: No, it doesn't. The documentation is pretty clear on the difference between AddSize and SectionSetSize.

Here is an example.

Section "Foo" GOOBAH
SectionEnd

Section "Bar"
SectionEnd

Function .onInit
SectionSetSize 0 100
SectionSetSize ${GOOBAH} 100
SectionSetSize 1 50
SectionSetSize 2 17
FunctionEnd
The first two SectionSetSize commands do the same thing because 0 is the index of the first section, and ${GOOBAH} refers to that same section. The third SectionSetSize command affects the "Bar" section because 1 is the index of the second section. The final SectionSetSize fails and sets the error flag because there isn't a third section, which the index of 2 refers to.

Almost verbatim from the documentation:
AddSize tells the installer that the current section needs an additional "size_kb" kilobytes of disk space.
The difference with SectionSetSize is that it declares an absolute size. The installer will automatically estimate how much space a section will require. You can use SectionSetSize to overwrite this estimate. SectionSetSize does not add to the estimate the installer makes.

By the way, you should have kept this in your original post instead of posting here and here.