diff options
Diffstat (limited to 'src/WixToolset.Core.WindowsInstaller/Bind/GenerateDatabaseCommand.cs')
| -rw-r--r-- | src/WixToolset.Core.WindowsInstaller/Bind/GenerateDatabaseCommand.cs | 27 |
1 files changed, 20 insertions, 7 deletions
diff --git a/src/WixToolset.Core.WindowsInstaller/Bind/GenerateDatabaseCommand.cs b/src/WixToolset.Core.WindowsInstaller/Bind/GenerateDatabaseCommand.cs index 3ab3b601..4e062696 100644 --- a/src/WixToolset.Core.WindowsInstaller/Bind/GenerateDatabaseCommand.cs +++ b/src/WixToolset.Core.WindowsInstaller/Bind/GenerateDatabaseCommand.cs | |||
| @@ -14,11 +14,14 @@ namespace WixToolset.Core.WindowsInstaller.Bind | |||
| 14 | using WixToolset.Core.Native; | 14 | using WixToolset.Core.Native; |
| 15 | using WixToolset.Data.WindowsInstaller; | 15 | using WixToolset.Data.WindowsInstaller; |
| 16 | using WixToolset.Extensibility.Services; | 16 | using WixToolset.Extensibility.Services; |
| 17 | using WixToolset.Extensibility.Data; | ||
| 17 | 18 | ||
| 18 | internal class GenerateDatabaseCommand | 19 | internal class GenerateDatabaseCommand |
| 19 | { | 20 | { |
| 20 | public int Codepage { private get; set; } | 21 | public int Codepage { private get; set; } |
| 21 | 22 | ||
| 23 | public IBackendHelper BackendHelper { private get; set; } | ||
| 24 | |||
| 22 | public IEnumerable<IFileSystemExtension> Extensions { private get; set; } | 25 | public IEnumerable<IFileSystemExtension> Extensions { private get; set; } |
| 23 | 26 | ||
| 24 | /// <summary> | 27 | /// <summary> |
| @@ -34,7 +37,9 @@ namespace WixToolset.Core.WindowsInstaller.Bind | |||
| 34 | 37 | ||
| 35 | public TableDefinitionCollection TableDefinitions { private get; set; } | 38 | public TableDefinitionCollection TableDefinitions { private get; set; } |
| 36 | 39 | ||
| 37 | public string TempFilesLocation { private get; set; } | 40 | public string IntermediateFolder { private get; set; } |
| 41 | |||
| 42 | public List<ITrackedFile> GeneratedTemporaryFiles { get; } = new List<ITrackedFile>(); | ||
| 38 | 43 | ||
| 39 | /// <summary> | 44 | /// <summary> |
| 40 | /// Whether to use a subdirectory based on the <paramref name="databaseFile"/> file name for intermediate files. | 45 | /// Whether to use a subdirectory based on the <paramref name="databaseFile"/> file name for intermediate files. |
| @@ -103,7 +108,7 @@ namespace WixToolset.Core.WindowsInstaller.Bind | |||
| 103 | } | 108 | } |
| 104 | 109 | ||
| 105 | // Set the base directory. | 110 | // Set the base directory. |
| 106 | string baseDirectory = this.TempFilesLocation; | 111 | var baseDirectory = this.IntermediateFolder; |
| 107 | 112 | ||
| 108 | if (this.UseSubDirectory) | 113 | if (this.UseSubDirectory) |
| 109 | { | 114 | { |
| @@ -114,7 +119,7 @@ namespace WixToolset.Core.WindowsInstaller.Bind | |||
| 114 | Directory.CreateDirectory(baseDirectory); | 119 | Directory.CreateDirectory(baseDirectory); |
| 115 | } | 120 | } |
| 116 | 121 | ||
| 117 | var idtDirectory = Path.Combine(baseDirectory, "idts"); | 122 | var idtDirectory = Path.Combine(baseDirectory, "_idts"); |
| 118 | Directory.CreateDirectory(idtDirectory); | 123 | Directory.CreateDirectory(idtDirectory); |
| 119 | 124 | ||
| 120 | try | 125 | try |
| @@ -137,6 +142,8 @@ namespace WixToolset.Core.WindowsInstaller.Bind | |||
| 137 | this.Output.Codepage = this.Codepage; | 142 | this.Output.Codepage = this.Codepage; |
| 138 | } | 143 | } |
| 139 | 144 | ||
| 145 | Directory.CreateDirectory(Path.GetDirectoryName(this.OutputPath)); | ||
| 146 | |||
| 140 | using (Database db = new Database(this.OutputPath, type)) | 147 | using (Database db = new Database(this.OutputPath, type)) |
| 141 | { | 148 | { |
| 142 | // if we're not using the default codepage, import a new one into our | 149 | // if we're not using the default codepage, import a new one into our |
| @@ -185,6 +192,9 @@ namespace WixToolset.Core.WindowsInstaller.Bind | |||
| 185 | var command = new CreateIdtFileCommand(this.Messaging, importTable, this.Output.Codepage, idtDirectory, this.KeepAddedColumns); | 192 | var command = new CreateIdtFileCommand(this.Messaging, importTable, this.Output.Codepage, idtDirectory, this.KeepAddedColumns); |
| 186 | command.Execute(); | 193 | command.Execute(); |
| 187 | 194 | ||
| 195 | var buildOutput = this.BackendHelper.TrackFile(command.IdtPath, TrackedFileType.Temporary); | ||
| 196 | this.GeneratedTemporaryFiles.Add(buildOutput); | ||
| 197 | |||
| 188 | db.Import(command.IdtPath); | 198 | db.Import(command.IdtPath); |
| 189 | } | 199 | } |
| 190 | catch (WixInvalidIdtException) | 200 | catch (WixInvalidIdtException) |
| @@ -309,7 +319,7 @@ namespace WixToolset.Core.WindowsInstaller.Bind | |||
| 309 | { | 319 | { |
| 310 | foreach (SubStorage subStorage in this.Output.SubStorages) | 320 | foreach (SubStorage subStorage in this.Output.SubStorages) |
| 311 | { | 321 | { |
| 312 | string transformFile = Path.Combine(this.TempFilesLocation, String.Concat(subStorage.Name, ".mst")); | 322 | string transformFile = Path.Combine(this.IntermediateFolder, String.Concat(subStorage.Name, ".mst")); |
| 313 | 323 | ||
| 314 | // Bind the transform. | 324 | // Bind the transform. |
| 315 | this.BindTransform(subStorage.Data, transformFile); | 325 | this.BindTransform(subStorage.Data, transformFile); |
| @@ -346,7 +356,7 @@ namespace WixToolset.Core.WindowsInstaller.Bind | |||
| 346 | var command = new BindTransformCommand(); | 356 | var command = new BindTransformCommand(); |
| 347 | command.Messaging = this.Messaging; | 357 | command.Messaging = this.Messaging; |
| 348 | command.Extensions = this.Extensions; | 358 | command.Extensions = this.Extensions; |
| 349 | command.TempFilesLocation = this.TempFilesLocation; | 359 | command.TempFilesLocation = this.IntermediateFolder; |
| 350 | command.Transform = transform; | 360 | command.Transform = transform; |
| 351 | command.OutputPath = outputPath; | 361 | command.OutputPath = outputPath; |
| 352 | command.TableDefinitions = this.TableDefinitions; | 362 | command.TableDefinitions = this.TableDefinitions; |
| @@ -356,8 +366,8 @@ namespace WixToolset.Core.WindowsInstaller.Bind | |||
| 356 | private void SetDatabaseCodepage(Database db, int codepage, string idtDirectory) | 366 | private void SetDatabaseCodepage(Database db, int codepage, string idtDirectory) |
| 357 | { | 367 | { |
| 358 | // write out the _ForceCodepage IDT file | 368 | // write out the _ForceCodepage IDT file |
| 359 | string idtPath = Path.Combine(idtDirectory, "_ForceCodepage.idt"); | 369 | var idtPath = Path.Combine(idtDirectory, "_ForceCodepage.idt"); |
| 360 | using (StreamWriter idtFile = new StreamWriter(idtPath, false, Encoding.ASCII)) | 370 | using (var idtFile = new StreamWriter(idtPath, false, Encoding.ASCII)) |
| 361 | { | 371 | { |
| 362 | idtFile.WriteLine(); // dummy column name record | 372 | idtFile.WriteLine(); // dummy column name record |
| 363 | idtFile.WriteLine(); // dummy column definition record | 373 | idtFile.WriteLine(); // dummy column definition record |
| @@ -365,6 +375,9 @@ namespace WixToolset.Core.WindowsInstaller.Bind | |||
| 365 | idtFile.WriteLine("\t_ForceCodepage"); | 375 | idtFile.WriteLine("\t_ForceCodepage"); |
| 366 | } | 376 | } |
| 367 | 377 | ||
| 378 | var trackId = this.BackendHelper.TrackFile(idtPath, TrackedFileType.Temporary); | ||
| 379 | this.GeneratedTemporaryFiles.Add(trackId); | ||
| 380 | |||
| 368 | // try to import the table into the MSI | 381 | // try to import the table into the MSI |
| 369 | try | 382 | try |
| 370 | { | 383 | { |
