How to add files to an archive using TUGZip ?
You're using quite exotic, but script friendly archiver. So just in short, you can make a script file for your archiver's TzScript.exe
command line tool like follows. To the Archive
property assign the target name of the archive, use a proper WorkingDir
and to the Data
put files you want to add to archive. I've hardcoded the archive name, but even this script file can be made by InnoSetup preprocessor (but that would be over the scope of this question):
function main()
{
var Comp = new Compress();
Comp.Archive = "d:\\DeployFolder\\Archives\\Archive1.zip";
Comp.Type = "ZIP";
Comp.Compression = 3;
Comp.WorkingDir = "d:\\ArchiveFolder\\";
Comp.Data = "File1.txt,File2.txt";
Comp.Password = "";
Comp.DateExtension = 0;
Comp.TimeExtension = 0;
Comp.Overwrite = 1;
Comp.Recurse = 0;
Comp.StoreFolderNames = 1;
Comp.IncludeHiddenFiles = 1;
Comp.DoCompress();
}
How to execute the TUGZip command line archiver before the InnoSetup script compilation ?
Much easier than putting this into a InnoSetup script would be to make a batch file, that would do all the stuff with the archiver and after it's done with brand new archives copied in your deploy folder, it would start InnoSetup compilation or just open the InnoSetup script file.
If you'd want to have this in your InnoSetup script, you'd need to use the preprocessor's Exec
function. Since it's a preprocessor function, it is performed before the InnoSetup script compilation starts, so it's the ideal place where you can do stuff like this.