View Single Post
Old 2nd September 2008, 12:06   #4
********
Junior Member
 
Join Date: May 2004
Posts: 43
Quote:
Originally posted by kichik
I don't understand what you're asking for.
I often use 7-Zip to get a file or two from my old NSIS installations for testing. Recently I decided to implement some automation for extracting these files. With ordinary archive, filepath relative to InstallDir is enough to get the file out of distribution. With NSIS it is not true.

One improvement is to detect when one file is added to several directories.

SetOutPath $INSTDIR
File example1.nsi
SetOutPath $INSTDIR\Kewl
File example1.nsi

In archive listing there will be only one entry of example1.nsi at root.

I understand that some paths are dynamically calculated at runtime, but these are rare. Most paths depends on unconditional combination of static strings that can be calculated relative to InstallDir at compile time. For example, when two strings are unconditionally assigned static values in some block and concatenated afterwards then resulting string is also static. I.e.

StrCpy $mydir "$INSTDIR\Kewl"
SetOutPath $mydir
File example2.nsi

This could create "Kewl\example2.nsi" entry inside archive instead of "$[32]\example2.nsi" Here is "unconditional assignment" - $mydir is initialized as constant and there is no branching that could make it contain different value until it is used in SetOutPath.

If the function receives only the same string variable that is written only once during script lifetime with the same constant value then this parameter to function can also be calculated as constant.
******** is offline   Reply With Quote