- NSIS Discussion
- Using an Install List file
Archive: Using an Install List file
josabraham
9th July 2007 12:23 UTC
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
Red Wine
9th July 2007 12:29 UTC
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.
josabraham
9th July 2007 13:25 UTC
Hi,
How can I do the extarction of comma separated strings from the line which I can read from the file?
Red Wine
9th July 2007 15:53 UTC
Check out the included StrFunc, TextFunc and WordFunc
josabraham
10th July 2007 12:33 UTC
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
Afrow UK
10th July 2007 12:46 UTC
Arrays are possible with the NSISArray plugin.
Stu
josabraham
10th July 2007 13:10 UTC
Thank you
josabraham
13th July 2007 07:26 UTC
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
kichik
13th July 2007 09:17 UTC
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
josabraham
13th July 2007 10:33 UTC
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
kichik
13th July 2007 10:36 UTC
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}"
Afrow UK
13th July 2007 11:04 UTC
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
josabraham
13th July 2007 11:33 UTC
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?
kichik
13th July 2007 11:38 UTC
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.
josabraham
13th July 2007 11:54 UTC
Thank you
regards
Josabraham
josabraham
18th July 2007 11:07 UTC
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
Afrow UK
18th July 2007 15:53 UTC
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