Archive: better method of creating the installer EXE ?


better method of creating the installer EXE ?
When NSIS is creating the installer EXE, I think it first creates this in the TEMP directory and then moves it to the specified place.

Isn't this a round-about way of doing it ? Why doesn't NSIS start "outputting" the installer EXE in the final place itself.

Wouldn't this be a spacesaver (and hence time saver) ?
- Shantanu


That's not true. There is only one fopen (build.cpp:1361) and it opens the output file directly, it doesn't create it in the temporary directory and then moves to the output directory.

FILE *fp = fopen(build_output_filename,"w+b");

You know why I was saying what I was saying...because when I tried to create a huge installer with the following code...
-----cut------
Name crap_trial
OutFile setup.exe
SetCompress off
InstallDir "C:\XYZ"
Section -
SetOutPath "$INSTDIR"
File /r "C:\Program Files\*.*"
SectionEnd
-----cut--------

...I got an error message which said...

------cut----------
Internal compiler error #12345: error mmapping datablock to 34257021.

Note: you may have one or two (large) stale temporary file(s)
left in your temporary directory (Generally this only happens on Windows 9x).
-------- cut ------

BTW, this error was for NSIS version 1.98.

I know the error says that this will happen on Win 9x systems. What is the problem ?


Well, the data block is saved is a memory mapped file which means it creates a temporary file and maps needed parts to memory. This is done so the data block will be able to grow bigger than your memory. I don't really know what is the problem with Windows 9x, but I guess it has a bug which causes it not to delete those temporary files.
The data block can't be directly written to the output file because the headers size is not yet known and moving the data block around in the file will take a lot of time.

There is a size limit on the installer which is:

Installers can be as large as 2GB (theoretically -- when building on Win9x the limit seems to be around 500MB, however building on NT then installing on Win9x works with larger sizes)
You probably got that error because you crossed this limit.

I don't know if I crossed the limit...

the installer crashed when it was trying to compress the AVI files(video codec Indeo 5) of Age of Empires. Out of these, the biggest is ~39 MB.

BTW, would the amount of main memory and VM size matter. The machine where the Win9x error was caused has 64MB RAM running Win98 SE. VM is fixed at 128 MB.

- Shantanu