Question

I have an Inno-Setup which internally just starts another setup. (I would like to rebuild it completely with InnoSetup but did not yet have time to do so.)

To run this internal setup, I need to provide some zip files. Currently I manually create those zip files and copy them into my InnoSetup-Folder. My idea is, to let the InnoSetup compile process create thees zip files. Needed files are located in different (but fixed) folders.

Is there an option to do so?

Here a more visual example:

  • C:\dir1\File1
  • C:\dir2\File2
  • C:\dir3\File3
  • C:\dir4\File4
  • C:\dir5\File5
  • C:\dir6\File6

  • Zip1 contains File1 and File2
  • Zip2 contains File3 and File4
  • Zip3 contains File5 and File6

Current Process

  • Zip1 - 3 are build manually
  • All three zip files will be compiled into one complete InnoSetup .exe file
  • While running the installation, the zip files will be copied to temp folder
  • the external setup tool will work on these zip files from temp folder.

Desired Process

  • Zip1 - 3 are automatically build by InnoSetup
  • rest is identical to current process

Thanks for your advises

Was it helpful?

Solution

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top