Move idts to to sub-folder of intermediate folder
Rob Mensching committed
Jul 19, 2018 at 00:44 UTC
afcdad136df85f06d0b753981ab75f683fe29663
1 file changed
+13
-16
src/WixToolset.Core.WindowsInstaller/Bind/GenerateDatabaseCommand.cs
+13
-16
@@ -114,6 +114,9 @@ namespace WixToolset.Core.WindowsInstaller.Bind
114
Directory.CreateDirectory(baseDirectory);
115
}
116
117
+ var idtDirectory = Path.Combine(baseDirectory, "idts");
118
+ Directory.CreateDirectory(idtDirectory);
119
+
120
try
121
{
122
OpenDatabase type = OpenDatabase.CreateDirect;
@@ -128,20 +131,20 @@ namespace WixToolset.Core.WindowsInstaller.Bind
131
Console.WriteLine("Opening database at: {0}", this.OutputPath);
132
#endif
133
131
- using (Database db = new Database(this.OutputPath, type))
134
+ // Localize the codepage if a value was specified directly.
135
+ if (-1 != this.Codepage)
136
{
133
- // Localize the codepage if a value was specified directly.
134
- if (-1 != this.Codepage)
135
- {
136
- this.Output.Codepage = this.Codepage;
137
- }
137
+ this.Output.Codepage = this.Codepage;
138
+ }
139
140
+ using (Database db = new Database(this.OutputPath, type))
141
+ {
142
// if we're not using the default codepage, import a new one into our
143
// database before we add any tables (or the tables would be added
144
// with the wrong codepage).
145
if (0 != this.Output.Codepage)
146
{
144
- this.SetDatabaseCodepage(db, this.Output.Codepage);
147
+ this.SetDatabaseCodepage(db, this.Output.Codepage, idtDirectory);
148
}
149
150
foreach (Table table in this.Output.Tables)
@@ -179,8 +182,7 @@ namespace WixToolset.Core.WindowsInstaller.Bind
182
{
183
try
184
{
182
- //db.ImportTable(this.Output.Codepage, importTable, baseDirectory, this.KeepAddedColumns);
183
- var command = new CreateIdtFileCommand(this.Messaging, importTable, this.Output.Codepage, baseDirectory, this.KeepAddedColumns);
185
+ var command = new CreateIdtFileCommand(this.Messaging, importTable, this.Output.Codepage, idtDirectory, this.KeepAddedColumns);
186
command.Execute();
187
188
db.Import(command.IdtPath);
@@ -351,15 +353,10 @@ namespace WixToolset.Core.WindowsInstaller.Bind
353
command.Execute();
354
}
355
354
- /// <summary>
355
- /// Sets the codepage of a database.
356
- /// </summary>
357
- /// <param name="db">Database to set codepage into.</param>
358
- /// <param name="output">Output with the codepage for the database.</param>
359
- private void SetDatabaseCodepage(Database db, int codepage)
356
+ private void SetDatabaseCodepage(Database db, int codepage, string idtDirectory)
357
{
358
// write out the _ForceCodepage IDT file
362
- string idtPath = Path.Combine(this.TempFilesLocation, "_ForceCodepage.idt");
359
+ string idtPath = Path.Combine(idtDirectory, "_ForceCodepage.idt");
360
using (StreamWriter idtFile = new StreamWriter(idtPath, false, Encoding.ASCII))
361
{
362
idtFile.WriteLine(); // dummy column name record