Skip to content
⌘ NSIS Forum Archive

Eliminating $_OUTDIR

7 posts

********#

Eliminating $_OUTDIR

I unpack binary Wesnoth installers (~300Mb) to build binary updates (~30Mb).
Unfortunately, unpacking means installing, because the dir structure inside
NSIS archive is mangled by the presence on $_OUTDIR directory.


SetOutPath "$INSTDIR\manual"
File /r /x .* doc\manual\*.html
File /r /x .* doc\manual\styles
File /r /x .* doc\manual\images
This will create the following structure:


manual
manual.cs.html
manual.de.html
manual.en.html
...
manual.zh_TW.html

$_OUTDIR
styles
manual.css
images
README.txt
game-screen-1.9.4.jpg
recruit-1.9.4.jpg
...
de
game-screen-1.9.14.jpg
...
Why there is $_OUTDIR prefix in one case and no prefix in another?
Is it possible to eliminate $_OUTDIR?
Anders#
NSIS was never designed to be unpacked but it is open source so somebody made an unpacker (which is great) so you really need to ask the author of the unpacker or just make a batch file to correct it after unpacking...
********#
The problem here (as it seems) that some paths in NSIS script are recorded as absolute to install dir and others as relative to some run-time variable, so in the latter case unpacking requires scripts interpretation.

If NSIS could make both records static (which seems pretty feasible), it will make installer format a little bit more friendly for open source users.
Afrow UK#
There is no reason the unpacker cannot prepend $OUTDIR to the relative paths. This kind of information is not required for the install process and would just add additional overhead.

Stu
********#
Unpacker actually prepends $_OUTDIR to the relative paths, but for some reason it can not calculate the actual path, which is relative to the installation dir. Unpacker is 7-Zip.

download, sources, free, gnu, lgpl, 7-zip, archiver, compression, software, compress, zip, unzip


There is a source code on this page. I tried to read it, but my C skill is too low to find out where the problem is and where it can be fixed, so that I could correctly unpack Wesnoth installer with properly restored dir structure relative to INSTDIR.
Afrow UK#
$OUTDIR is set with SetOutPath, or it can be set directly (e.g. with StrCpy). Therefore it's not really possible for the unpacker to know what its value will be - it will only be known when actually running the installer.

Stu
********#
I thought about this too, but then how these *.html files are end up being in correct manual/ subdirectory and not in $_OUTDIR after unpacking?

SetOutPath "$INSTDIR\manual"
File /r /x .* doc\manual\*.html