diff options
Diffstat (limited to 'src/wix/WixToolset.Core.Burn/Bundles/BurnReader.cs')
-rw-r--r-- | src/wix/WixToolset.Core.Burn/Bundles/BurnReader.cs | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/src/wix/WixToolset.Core.Burn/Bundles/BurnReader.cs b/src/wix/WixToolset.Core.Burn/Bundles/BurnReader.cs index e3d0f0af..e87e32c7 100644 --- a/src/wix/WixToolset.Core.Burn/Bundles/BurnReader.cs +++ b/src/wix/WixToolset.Core.Burn/Bundles/BurnReader.cs | |||
@@ -27,16 +27,19 @@ namespace WixToolset.Core.Burn.Bundles | |||
27 | 27 | ||
28 | private BinaryReader binaryReader; | 28 | private BinaryReader binaryReader; |
29 | private readonly List<DictionaryEntry> attachedContainerPayloadNames; | 29 | private readonly List<DictionaryEntry> attachedContainerPayloadNames; |
30 | private readonly IFileSystem fileSystem; | ||
30 | 31 | ||
31 | /// <summary> | 32 | /// <summary> |
32 | /// Creates a BurnReader for reading a PE file. | 33 | /// Creates a BurnReader for reading a PE file. |
33 | /// </summary> | 34 | /// </summary> |
34 | /// <param name="messaging"></param> | 35 | /// <param name="messaging">Messaging.</param> |
36 | /// <param name="fileSystem">File system.</param> | ||
35 | /// <param name="fileExe">File to read.</param> | 37 | /// <param name="fileExe">File to read.</param> |
36 | private BurnReader(IMessaging messaging, string fileExe) | 38 | private BurnReader(IMessaging messaging, IFileSystem fileSystem, string fileExe) |
37 | : base(messaging, fileExe) | 39 | : base(messaging, fileExe) |
38 | { | 40 | { |
39 | this.attachedContainerPayloadNames = new List<DictionaryEntry>(); | 41 | this.attachedContainerPayloadNames = new List<DictionaryEntry>(); |
42 | this.fileSystem = fileSystem; | ||
40 | } | 43 | } |
41 | 44 | ||
42 | /// <summary> | 45 | /// <summary> |
@@ -47,13 +50,14 @@ namespace WixToolset.Core.Burn.Bundles | |||
47 | /// <summary> | 50 | /// <summary> |
48 | /// Opens a Burn reader. | 51 | /// Opens a Burn reader. |
49 | /// </summary> | 52 | /// </summary> |
50 | /// <param name="messaging"></param> | 53 | /// <param name="messaging">Messaging.</param> |
54 | /// <param name="fileSystem">File system.</param> | ||
51 | /// <param name="fileExe">Path to file.</param> | 55 | /// <param name="fileExe">Path to file.</param> |
52 | /// <returns>Burn reader.</returns> | 56 | /// <returns>Burn reader.</returns> |
53 | public static BurnReader Open(IMessaging messaging, string fileExe) | 57 | public static BurnReader Open(IMessaging messaging, IFileSystem fileSystem, string fileExe) |
54 | { | 58 | { |
55 | var binaryReader = new BinaryReader(File.Open(fileExe, FileMode.Open, FileAccess.Read, FileShare.Read | FileShare.Delete)); | 59 | var binaryReader = new BinaryReader(File.Open(fileExe, FileMode.Open, FileAccess.Read, FileShare.Read | FileShare.Delete)); |
56 | var reader = new BurnReader(messaging, fileExe) | 60 | var reader = new BurnReader(messaging, fileSystem, fileExe) |
57 | { | 61 | { |
58 | binaryReader = binaryReader, | 62 | binaryReader = binaryReader, |
59 | }; | 63 | }; |
@@ -96,8 +100,7 @@ namespace WixToolset.Core.Burn.Bundles | |||
96 | var cabinet = new Cabinet(tempCabPath); | 100 | var cabinet = new Cabinet(tempCabPath); |
97 | cabinet.Extract(outputDirectory); | 101 | cabinet.Extract(outputDirectory); |
98 | 102 | ||
99 | Directory.CreateDirectory(Path.GetDirectoryName(manifestPath)); | 103 | this.fileSystem.MoveFile(manifestOriginalPath, manifestPath); |
100 | FileSystem.MoveFile(manifestOriginalPath, manifestPath); | ||
101 | 104 | ||
102 | var document = new XmlDocument(); | 105 | var document = new XmlDocument(); |
103 | document.Load(manifestPath); | 106 | document.Load(manifestPath); |
@@ -114,8 +117,7 @@ namespace WixToolset.Core.Burn.Bundles | |||
114 | var sourcePath = Path.Combine(outputDirectory, sourcePathNode.Value); | 117 | var sourcePath = Path.Combine(outputDirectory, sourcePathNode.Value); |
115 | var destinationPath = Path.Combine(outputDirectory, filePathNode.Value); | 118 | var destinationPath = Path.Combine(outputDirectory, filePathNode.Value); |
116 | 119 | ||
117 | Directory.CreateDirectory(Path.GetDirectoryName(destinationPath)); | 120 | this.fileSystem.MoveFile(sourcePath, destinationPath); |
118 | FileSystem.MoveFile(sourcePath, destinationPath); | ||
119 | } | 121 | } |
120 | 122 | ||
121 | foreach (XmlNode payload in payloads) | 123 | foreach (XmlNode payload in payloads) |
@@ -183,8 +185,7 @@ namespace WixToolset.Core.Burn.Bundles | |||
183 | var sourcePath = Path.Combine(outputDirectory, (string)entry.Key); | 185 | var sourcePath = Path.Combine(outputDirectory, (string)entry.Key); |
184 | var destinationPath = Path.Combine(outputDirectory, (string)entry.Value); | 186 | var destinationPath = Path.Combine(outputDirectory, (string)entry.Value); |
185 | 187 | ||
186 | Directory.CreateDirectory(Path.GetDirectoryName(destinationPath)); | 188 | this.fileSystem.MoveFile(sourcePath, destinationPath); |
187 | FileSystem.MoveFile(sourcePath, destinationPath); | ||
188 | } | 189 | } |
189 | 190 | ||
190 | return true; | 191 | return true; |