@joebigelow / wix / commits / 77e61187

Let caller specify directory for files extracted by ExtractCabinetsCommand.

Bob Arnson committed Dec 7, 2018 at 19:42 UTC 77e611874a3d3d45e51a46e75674c44d418670cb
2 files changed +9 -9
src/WixToolset.Core.WindowsInstaller/Decompile/DecompileMsiOrMsmCommand.cs
+4 -2
@@ -5,7 +5,7 @@ namespace WixToolset.Core.WindowsInstaller.Unbind
5 using System;
6 using System.Collections.Generic;
7 using System.ComponentModel;
8 - using System.Linq;
8 + using System.IO;
9 using WixToolset.Core.Native;
10 using WixToolset.Data;
11 using WixToolset.Extensibility;
@@ -46,7 +46,9 @@ namespace WixToolset.Core.WindowsInstaller.Unbind
46 // extract the files from the cabinets
47 if (!String.IsNullOrEmpty(this.Context.ExtractFolder) && !this.Context.SuppressExtractCabinets)
48 {
49 - var extractCommand = new ExtractCabinetsCommand(output, database, this.Context.DecompilePath, this.Context.ExtractFolder, this.Context.IntermediateFolder, this.Context.TreatProductAsModule);
49 + var fileDirectory = Path.Combine(this.Context.ExtractFolder, "File");
50 +
51 + var extractCommand = new ExtractCabinetsCommand(output, database, this.Context.DecompilePath, fileDirectory, this.Context.IntermediateFolder, this.Context.TreatProductAsModule);
52 extractCommand.Execute();
53
54 extractedFilePaths.AddRange(extractCommand.ExtractedFiles);
src/WixToolset.Core.WindowsInstaller/Unbind/ExtractCabinetsCommand.cs
+5 -7
@@ -121,23 +121,21 @@ namespace WixToolset.Core.WindowsInstaller.Unbind
121 // extract the cabinet files
122 if (0 < cabinetFiles.Count)
123 {
124 - var fileDirectory = Path.Combine(this.ExportBasePath, "File");
125 -
124 // delete the directory and its files to prevent cab extraction due to an existing file
127 - if (Directory.Exists(fileDirectory))
125 + if (Directory.Exists(this.ExportBasePath))
126 {
129 - Directory.Delete(fileDirectory, true);
127 + Directory.Delete(this.ExportBasePath, true);
128 }
129
130 // ensure the directory exists or extraction will fail
133 - Directory.CreateDirectory(fileDirectory);
131 + Directory.CreateDirectory(this.ExportBasePath);
132
133 foreach (var cabinetFile in cabinetFiles)
134 {
135 try
136 {
137 var cabinet = new Cabinet(cabinetFile);
140 - cabinet.Extract(fileDirectory);
138 + cabinet.Extract(this.ExportBasePath);
139 }
140 catch (FileNotFoundException)
141 {
@@ -145,7 +143,7 @@ namespace WixToolset.Core.WindowsInstaller.Unbind
143 }
144 }
145
148 - this.ExtractedFiles = Directory.GetFiles(fileDirectory);
146 + this.ExtractedFiles = Directory.GetFiles(this.ExportBasePath);
147 }
148 else
149 {