corneliu
20th July 2011 16:26 UTC
one file bundle
Hey everyone,
I have built an installer which does the job just fine. Now I would like to bundle all the files (icons, logos, licenses, nsi installer and other dependencies) in one installer file. I can't find a tutorial that explains this stuff. I know it exists. Can anybody point to it, please?
Thank you in advance,
Corneliu
MSG
20th July 2011 16:34 UTC
What exactly are you trying to accomplish? You can put any file in your installer by using the File command...
LoRd_MuldeR
20th July 2011 19:31 UTC
Once you have compiled your installer script (.nsi) with MakeNSIS.exe, you get a fully self-contained installer EXE file. That EXE contains all the required resources (like Icon, License, etc). And, as MSG said, if any files are extracted from your installer (during the install process) using the "File" command, then these file are included into the installer EXE automatically. No need to "bundle" anything manually.
corneliu
20th July 2011 20:11 UTC
Thank you MSG and LoRd_MuldeR,
That's what I was looking for, the File command. One thing I want to mention for those who are looking for help and are reading this thread. You must set SetOutPath before using the File command otherwise the files are not found.
Everything works well now.
Cheers,
Corneliu
LoRd_MuldeR
20th July 2011 20:23 UTC
Originally posted by corneliu
You must set SetOutPath before using the File command otherwise the files are not found.
Not found?
SetOutPath sets the output path ($OUTDIR) where the files are extracted to -
at install time.
Usually you will do "SetOutPath $INSTDIR", so the files are extracted to the install path ($INSTDIR) the user has selected.
And this is documented quite clear, I think.
4.9.1.5 File
Adds file(s) to be extracted to the current output path ($OUTDIR).
Note that the output file name is $OUTDIR\filename_portion_of_file.
corneliu
20th July 2011 21:15 UTC
When the script is compiled the files are added to the executable. All good so far, the executable is fat. Now when you execute the executable, it extracts the files somewhere where it can't find them. I want to copy the extracted files to the installation folder in Program Files. But they are not found anymore. That's why I have to set SetOutPath before using the File command. I know it is documented, just it can be easily overlooked. It took me quite a while to figure it out.
LoRd_MuldeR
20th July 2011 21:22 UTC
File is an install time command. It is executed when the user runs the installer. And, as the documentation explains, File extracts to the path specified by $OUTDIR. You can change $OUTDIR by using SetOutPath. You could use this to extract to some fixed path, e.g. a specific sub-dir of "Program Files". However it usually is better to set $OUTDIR to $INSTDIR, i.e. the install dir chosen by the user. You can set a default for $INSTDIR via InstallDir. And always use $PROGRAMFILES instead of "hard-coded" paths.
Extremely bad idea:
Section "Application"
SetOutPath "C:\Program Files\Your Company\Your Product"
File "MySuperDuperApplication.exe"
SectionEnd
Works okay, but usually not recommended:
Section "Application"
SetOutPath "$PROGRAMFILES\Your Company\Your Product"
File "MySuperDuperApplication.exe"
SectionEnd
Recommended:
InstallDir "$PROGRAMFILES\Your Company\Your Product"
Section "Application"
SetOutPath $INSTDIR
File "MySuperDuperApplication.exe"
SectionEnd