aboutsummaryrefslogtreecommitdiff
path: root/src/WixToolset.Core.WindowsInstaller/Bind/GenerateDatabaseCommand.cs
diff options
context:
space:
mode:
authorRob Mensching <rob@firegiant.com>2021-03-19 10:29:21 -0700
committerRob Mensching <rob@firegiant.com>2021-03-19 11:25:39 -0700
commit13c7babf53b7c87e0147ea21732d2473477ac8cb (patch)
treea5853338bcf559c3cb3e00467eeebdd46a490063 /src/WixToolset.Core.WindowsInstaller/Bind/GenerateDatabaseCommand.cs
parenteb1fe8aefa064f943f31a79ba00436947b653cdd (diff)
downloadwix-13c7babf53b7c87e0147ea21732d2473477ac8cb.tar.gz
wix-13c7babf53b7c87e0147ea21732d2473477ac8cb.tar.bz2
wix-13c7babf53b7c87e0147ea21732d2473477ac8cb.zip
Minor code cleanup
Diffstat (limited to 'src/WixToolset.Core.WindowsInstaller/Bind/GenerateDatabaseCommand.cs')
-rw-r--r--src/WixToolset.Core.WindowsInstaller/Bind/GenerateDatabaseCommand.cs18
1 files changed, 8 insertions, 10 deletions
diff --git a/src/WixToolset.Core.WindowsInstaller/Bind/GenerateDatabaseCommand.cs b/src/WixToolset.Core.WindowsInstaller/Bind/GenerateDatabaseCommand.cs
index 06fbf072..f125f497 100644
--- a/src/WixToolset.Core.WindowsInstaller/Bind/GenerateDatabaseCommand.cs
+++ b/src/WixToolset.Core.WindowsInstaller/Bind/GenerateDatabaseCommand.cs
@@ -16,6 +16,8 @@ namespace WixToolset.Core.WindowsInstaller.Bind
16 16
17 internal class GenerateDatabaseCommand 17 internal class GenerateDatabaseCommand
18 { 18 {
19 private const string IdtsSubFolder = "_idts";
20
19 public GenerateDatabaseCommand(IMessaging messaging, IBackendHelper backendHelper, FileSystemManager fileSystemManager, WindowsInstallerData data, string outputPath, TableDefinitionCollection tableDefinitions, string intermediateFolder, int codepage, bool keepAddedColumns, bool suppressAddingValidationRows, bool useSubdirectory) 21 public GenerateDatabaseCommand(IMessaging messaging, IBackendHelper backendHelper, FileSystemManager fileSystemManager, WindowsInstallerData data, string outputPath, TableDefinitionCollection tableDefinitions, string intermediateFolder, int codepage, bool keepAddedColumns, bool suppressAddingValidationRows, bool useSubdirectory)
20 { 22 {
21 this.Messaging = messaging; 23 this.Messaging = messaging;
@@ -77,7 +79,7 @@ namespace WixToolset.Core.WindowsInstaller.Bind
77 baseDirectory = Path.Combine(baseDirectory, filename); 79 baseDirectory = Path.Combine(baseDirectory, filename);
78 } 80 }
79 81
80 var idtFolder = Path.Combine(baseDirectory, "_idts"); 82 var idtFolder = Path.Combine(baseDirectory, IdtsSubFolder);
81 83
82 var type = OpenDatabase.CreateDirect; 84 var type = OpenDatabase.CreateDirect;
83 85
@@ -94,10 +96,6 @@ namespace WixToolset.Core.WindowsInstaller.Bind
94 96
95 try 97 try
96 { 98 {
97#if DEBUG
98 Console.WriteLine("Opening database at: {0}", this.OutputPath);
99#endif
100
101 Directory.CreateDirectory(Path.GetDirectoryName(this.OutputPath)); 99 Directory.CreateDirectory(Path.GetDirectoryName(this.OutputPath));
102 100
103 Directory.CreateDirectory(idtFolder); 101 Directory.CreateDirectory(idtFolder);
@@ -221,8 +219,8 @@ namespace WixToolset.Core.WindowsInstaller.Bind
221 var command = new CreateIdtFileCommand(this.Messaging, importTable, this.Data.Codepage, idtDirectory, this.KeepAddedColumns); 219 var command = new CreateIdtFileCommand(this.Messaging, importTable, this.Data.Codepage, idtDirectory, this.KeepAddedColumns);
222 command.Execute(); 220 command.Execute();
223 221
224 var buildOutput = this.BackendHelper.TrackFile(command.IdtPath, TrackedFileType.Temporary); 222 var trackIdt = this.BackendHelper.TrackFile(command.IdtPath, TrackedFileType.Temporary);
225 this.GeneratedTemporaryFiles.Add(buildOutput); 223 this.GeneratedTemporaryFiles.Add(trackIdt);
226 224
227 db.Import(command.IdtPath); 225 db.Import(command.IdtPath);
228 } 226 }
@@ -401,8 +399,8 @@ namespace WixToolset.Core.WindowsInstaller.Bind
401 idtFile.WriteLine("\t_ForceCodepage"); 399 idtFile.WriteLine("\t_ForceCodepage");
402 } 400 }
403 401
404 var trackId = this.BackendHelper.TrackFile(idtPath, TrackedFileType.Temporary); 402 var trackIdt = this.BackendHelper.TrackFile(idtPath, TrackedFileType.Temporary);
405 this.GeneratedTemporaryFiles.Add(trackId); 403 this.GeneratedTemporaryFiles.Add(trackIdt);
406 404
407 // Try to import the table into the MSI. 405 // Try to import the table into the MSI.
408 try 406 try
@@ -411,7 +409,7 @@ namespace WixToolset.Core.WindowsInstaller.Bind
411 } 409 }
412 catch (WixInvalidIdtException) 410 catch (WixInvalidIdtException)
413 { 411 {
414 // The IDT should be valid, so an invalid code page was given. 412 // The IDT should always be generated correctly, so an invalid code page was given.
415 throw new WixException(ErrorMessages.IllegalCodepage(codepage)); 413 throw new WixException(ErrorMessages.IllegalCodepage(codepage));
416 } 414 }
417 } 415 }