Skip to content
⌘ NSIS Forum Archive

NSIS 3 Page Directory Required Size

3 posts

ThirtySomething#

NSIS 3 Page Directory Required Size

Hello @all,

I'm using NSIS 3.01 and my installer works fine except the required space. I've googled this topic and search also this forum here, but was not able to solve the problem. Let's go more into details:
  • I've splitted the complete code into several files
  • The main file includes all other files
  • The anonymous main section will call other functions in dependecy a fresh install is required or an update has to be performed
  • The install function again is splitted into several sub-functions to perform grouped operations like creation of directories, copying of files, adding shortcuts and so on
  • For the directory selection page also a separate file exists with pre- and post-functions


As mentioned above, the search with google and inside this forum pops up some potential solutions:
  • SectionGetSize/SectionSetSize - The anonymous default section was provided with a name and an ID. I've tried to read the size and set it to the directory selection page without any succes. The size was always 0.
  • GetSize - While creating the uninstaller, the usage of GetSize works perfect. But this information is not available while asking the user for the installation directory because this step is performed after the user request.
  • AddSize - This function works perfect, but the problem is the same like on GetSize - I don't know the size before installation.
  • .onVerifyInstDir - This function looks also very promising, but the default installation dir is presetted and the function never executed.
  • .onInit - The manual setting of the size works like a charme, but the problem is the same like on GetSize - the size is unknow at this step.


As far as I understood the documentation, the filesize should be added automagically to the section by the usage of FILE. But I've found no way to get this information and to set it for the "Page directory" where the user is asked for the installation path.

My last idea was to do first a complete install into a temporary directory, claim the size and then move it to the user selected destination. But then... I thought by myself that I've missed something.

Can anyone please push me to right direction? The major scripts are attached.
Anders#
SectionGet/SetSize takes a section id define, not a variable! The documentation has a example.

You normally don't have to do anything to calculate the size, just put the File instructions in sections (not functions) and everything should be calculated automatically.
ThirtySomething#
Now it works

Hello Anders,

thanks to your hints 👍 I take a review on the installer files and created a single one. Now I'm using only functions if necessary. The FILE command is used in the install section. The SectionGetSize and SectionSetSize commands work now as expected. I didn't realize that using functions will break the "count of installsize" mechanism of the FILE command.

Regards

ThirtySomething