Archive: Using an Install List file


Using an Install List file
Hello

I would like to create an Installer for my app. There are hundreds of files. so I like to do it in the following way. I list all files and folders in a text file. I want to read it from NSIS script in a loop and then install the files. This helps me to add new files and folders only to the List files (a text file).

while not end of file
{
Read Lines in text file
Install files
}

Structure of list file


1---> Index of List of destination directories to be created
2---> Index of files to be copied

2, Filename, SRC_FOLDER, DEST_FOLDER,RegisterFile


1 Register File
0 Do not Registerfile

Sample structure of file

1, 1, destFolder1,0
1, 2, destFolder2,1

2, 1, Test1.dll, source, destination, true
2, 2, Test2.dll, source, destination, flase


Can you show me some sample code which does the same.

How can I read a file using loop since the end of file is encountered?

regards
Josabraham


That could be done if you create a small program (easy to do it with nsis) which reads the text file and creates a proper header which is included in your main script.


Hi,

How can I do the extarction of comma separated strings from the line which I can read from the file?


Check out the included StrFunc, TextFunc and WordFunc


Is it possible to create arrays and structures in NSIS?
Hi Thank you for the reply

Is it possible to create arrays and structures in NSIS?

Regards

Josabraham


Arrays are possible with the NSISArray plugin.

Stu


Thank you


String Concatenation
Hello I try to concatenate the strings in the following way.But it does n't work?

What is wrong with this?
==================================================
strcpy $FinalName $DestFolder
strcpy $FinalName $FileName
Messagebox MB_ICONINFORMATION|MB_OK $FinalName
==================================================

best regards

josabraham


StrCpy copies a string into a variable. It does not concatenate a string to a variable. Copy the string you want to appear in the variable directly instead of using StrCpy twice.

StrCpy $FinalName $DestFolder\$FileName

File name from a variable
Thank you,

Now I have file name with full path in the variable $Final name.

Is it possible to specify file name as below.This gives error

=========================
File $FinalName
=========================

best regards

josabraham


No, of course you can't do that. You can't have the script, which runs on the user machine, determine which files go into the installer. Think about it, the compiler would need to run the script, predict the details of the user computer and compress files according to that.

What you're looking for is !define.

!define DestFolder something
!define FileName blah.dat
!define FinalName "${DestFolder}\${FileName}"

File "${FinalName}"

To put it into perspective, variables are for run time use whereas constants are for compile time.
If you need to do run time stuff on compile time, then see this page:
http://nsis.sourceforge.net/Invoking...n_compile-time

Stu


file names from list file
Hello thank you for the reply,

I get filenames from a text file.I open the file.There are parts in the list fie.

1 it list all directories there.

1,0,MainDir1
1,1,MainDir1\subDir1
1,2,MainDir2

2 item list the files

2,0,Filename,index of srcDir, index of destDir, reg = true or false

99; end of list file

So I read the file and build the output path suitably

So all the file names are coming from the list text file.So filenames are available only at run time.

So the script is not aware of the names of the files or destination or source directories.So I cannot declare the names as constants.

This type of design is possible using NSIS?


In this case, you need two runtimes. One that reads the list file and one that actually installs it. Make a program or an installer that creates a script according to the list file and compile that script to generate the real installer. Afrow's link demonstrates how this can be done in one step.


Thank you

regards

Josabraham


Compiling only changed files
Hello,

My project is consist of more than 2500 files to be processed.So compiling the output for every minor change takes long time.

Is there any way to create the output with out processing the whole files.Meaning by including only changed files(Like in Visual C++ IDE)

best regards

josabraham


Have it not run the executable itself so that you have to run it manually, and/or only have it ran if the list file does not exist.

The only real solution is to get the number of files in the folder or the size of the folder and compare it to the number of files or size that was gained the last time.

Stu