Self Extracting Archive and file removal

Apr 15, 2010 at 1:07 PM

I have been running into a strange issue with a self extracting archive and RemoveUnpackedFilesAfterExecute = true.  When I execute the created self extracting archive, it extracts and executes the file I have directed it to.  When that executable finishes, only one file is deleted that was extracted (there were 8 files in the archive).  I am not sure if this is a bug or I am doing something incorrectly.  My code to create the package is below:

       private void btnPackage_Click(object sender, EventArgs e) {
            string outputFileName;

            using (Ionic.Zip.ZipFile zip = new Ionic.Zip.ZipFile()) {

                // Add manifest file
                zip.AddFile(txtManifestFilePath.Text, ".");

                // Add wizard file
                zip.AddFile(txtWizardFilePath.Text, ".");

                // Add resource files
                zip.AddFiles(resourceFilePaths, ".");

                zip.Encryption = Ionic.Zip.EncryptionAlgorithm.WinZipAes256;

                Ionic.Zip.SelfExtractorSaveOptions options = new Ionic.Zip.SelfExtractorSaveOptions();
                options.DefaultExtractDirectory = "%TEMP%";
                options.ExtractExistingFile = Ionic.Zip.ExtractExistingFileAction.OverwriteSilently;
                options.Flavor = Ionic.Zip.SelfExtractorFlavor.ConsoleApplication;
                options.IconFile = System.IO.Path.Combine(Application.StartupPath, "box_software.ico");
                options.PostExtractCommandLine = System.IO.Path.GetFileName(txtWizardFilePath.Text);
                options.Quiet = true;
                options.RemoveUnpackedFilesAfterExecute = true;

                outputFileName = txtOutputFilename.Text;
                if (!outputFileName.EndsWith(".exe")) {
                    outputFileName = string.Concat(outputFileName, ".exe");
                }

                zip.SaveSelfExtractor(outputFileName, options);
            }

        }

Coordinator
Apr 21, 2010 at 3:57 PM
This discussion has been copied to a work item. Click here to go to the work item and continue the discussion.
Coordinator
Apr 21, 2010 at 3:57 PM

Thanks for reporting it.

what version of the library are you using?

Apr 21, 2010 at 4:20 PM

I am using version 1.9.1.5.