From 77e611874a3d3d45e51a46e75674c44d418670cb Mon Sep 17 00:00:00 2001 From: Bob Arnson Date: Fri, 7 Dec 2018 19:42:42 -0500 Subject: Let caller specify directory for files extracted by ExtractCabinetsCommand. --- .../Decompile/DecompileMsiOrMsmCommand.cs | 6 ++++-- .../Unbind/ExtractCabinetsCommand.cs | 12 +++++------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/WixToolset.Core.WindowsInstaller/Decompile/DecompileMsiOrMsmCommand.cs b/src/WixToolset.Core.WindowsInstaller/Decompile/DecompileMsiOrMsmCommand.cs index e874eed6..d622dbb2 100644 --- a/src/WixToolset.Core.WindowsInstaller/Decompile/DecompileMsiOrMsmCommand.cs +++ b/src/WixToolset.Core.WindowsInstaller/Decompile/DecompileMsiOrMsmCommand.cs @@ -5,7 +5,7 @@ namespace WixToolset.Core.WindowsInstaller.Unbind using System; using System.Collections.Generic; using System.ComponentModel; - using System.Linq; + using System.IO; using WixToolset.Core.Native; using WixToolset.Data; using WixToolset.Extensibility; @@ -46,7 +46,9 @@ namespace WixToolset.Core.WindowsInstaller.Unbind // extract the files from the cabinets if (!String.IsNullOrEmpty(this.Context.ExtractFolder) && !this.Context.SuppressExtractCabinets) { - var extractCommand = new ExtractCabinetsCommand(output, database, this.Context.DecompilePath, this.Context.ExtractFolder, this.Context.IntermediateFolder, this.Context.TreatProductAsModule); + var fileDirectory = Path.Combine(this.Context.ExtractFolder, "File"); + + var extractCommand = new ExtractCabinetsCommand(output, database, this.Context.DecompilePath, fileDirectory, this.Context.IntermediateFolder, this.Context.TreatProductAsModule); extractCommand.Execute(); extractedFilePaths.AddRange(extractCommand.ExtractedFiles); diff --git a/src/WixToolset.Core.WindowsInstaller/Unbind/ExtractCabinetsCommand.cs b/src/WixToolset.Core.WindowsInstaller/Unbind/ExtractCabinetsCommand.cs index eaed16b8..fab780f8 100644 --- a/src/WixToolset.Core.WindowsInstaller/Unbind/ExtractCabinetsCommand.cs +++ b/src/WixToolset.Core.WindowsInstaller/Unbind/ExtractCabinetsCommand.cs @@ -121,23 +121,21 @@ namespace WixToolset.Core.WindowsInstaller.Unbind // extract the cabinet files if (0 < cabinetFiles.Count) { - var fileDirectory = Path.Combine(this.ExportBasePath, "File"); - // delete the directory and its files to prevent cab extraction due to an existing file - if (Directory.Exists(fileDirectory)) + if (Directory.Exists(this.ExportBasePath)) { - Directory.Delete(fileDirectory, true); + Directory.Delete(this.ExportBasePath, true); } // ensure the directory exists or extraction will fail - Directory.CreateDirectory(fileDirectory); + Directory.CreateDirectory(this.ExportBasePath); foreach (var cabinetFile in cabinetFiles) { try { var cabinet = new Cabinet(cabinetFile); - cabinet.Extract(fileDirectory); + cabinet.Extract(this.ExportBasePath); } catch (FileNotFoundException) { @@ -145,7 +143,7 @@ namespace WixToolset.Core.WindowsInstaller.Unbind } } - this.ExtractedFiles = Directory.GetFiles(fileDirectory); + this.ExtractedFiles = Directory.GetFiles(this.ExportBasePath); } else { -- cgit v1.2.3-55-g6feb