Archive: PLUGINSDIR and ReserveFile


PLUGINSDIR and ReserveFile
Hi all,

I am curious, do all files that get installed to PLUGINSDIR get automagically set at the top block of the Installer?

Ie, does doing the "File" command with the output location set to PLUGINSDIR automatically get set as a ReserveFile?

Looking at MUI2 source code, I see no particular attempt at Reserving the things that go into the Plugindir, which is why I ask...

Like in Contrib\Modern UI 2\Interface.nsh, we can see:

File "/oname=$PLUGINSDIR\modern-header.bmp" "${MUI_HEADERIMAGE_${UNINSTALLER}BITMAP_RTL}"

I also have some bitmaps in my own code that I copy to PLUGINSDIR, and I want to make sure that indeed, they are at the top of the Installer data code...


No they are not reserved automatically and I don't think this is a problem in Modern UI because MUI.nsh is what you should include first in your script.

Stu


Open "NSIS\Contrib\Modern UI\System.nsh" in an editor and search for "ReserveFile" ;)


Oh, yeah, for the MUI2 files, I can see you don't need to do the Reserve, as its always included first.

But what our scripts, say we have a "File" command buried down in one of our functions towards the end of our script, perhaps 1+ Gigs deep into the Installer.

I guess I better just play it safe, and do the ReserveFile, just in case.

One more question about ReserveFile...
Does NSIS parse the full script first to find all ReserveFile commands, before it parses the script to actually built the Installer?

If it doesn't, does this mean I need to put the ReserveFile command as close to the top of the "main" script as possible?

Scott


I think MakeNSIS will run through the script and it will add a file to the data block as soon as that file appears in a "File" or "ReserveFile" instruction. So yes, if I'm not mistaken you should put the "ReserveFile" instructions at the top of your script. But there is no need to reserve any files, unless they are extracted out of order. For example files extracted in your ".onInit" function should be reserved. Files extracted only in normal "Section" blocks shouldn't be reserved...