diff options
| author | Rob Mensching <rob@firegiant.com> | 2018-07-19 00:44:34 -0700 |
|---|---|---|
| committer | Rob Mensching <rob@firegiant.com> | 2018-07-19 00:44:34 -0700 |
| commit | afcdad136df85f06d0b753981ab75f683fe29663 (patch) | |
| tree | e823a5043891d6bc9d92d9d6a322c10495675c56 /src/WixToolset.Core.WindowsInstaller/Bind/GenerateDatabaseCommand.cs | |
| parent | 1668381783283633667df0a12bb9b4568a12def2 (diff) | |
| download | wix-afcdad136df85f06d0b753981ab75f683fe29663.tar.gz wix-afcdad136df85f06d0b753981ab75f683fe29663.tar.bz2 wix-afcdad136df85f06d0b753981ab75f683fe29663.zip | |
Move idts to to sub-folder of intermediate folder
Diffstat (limited to 'src/WixToolset.Core.WindowsInstaller/Bind/GenerateDatabaseCommand.cs')
| -rw-r--r-- | src/WixToolset.Core.WindowsInstaller/Bind/GenerateDatabaseCommand.cs | 29 |
1 files changed, 13 insertions, 16 deletions
diff --git a/src/WixToolset.Core.WindowsInstaller/Bind/GenerateDatabaseCommand.cs b/src/WixToolset.Core.WindowsInstaller/Bind/GenerateDatabaseCommand.cs index 3357db3e..1a77b84e 100644 --- a/src/WixToolset.Core.WindowsInstaller/Bind/GenerateDatabaseCommand.cs +++ b/src/WixToolset.Core.WindowsInstaller/Bind/GenerateDatabaseCommand.cs | |||
| @@ -114,6 +114,9 @@ namespace WixToolset.Core.WindowsInstaller.Bind | |||
| 114 | Directory.CreateDirectory(baseDirectory); | 114 | Directory.CreateDirectory(baseDirectory); |
| 115 | } | 115 | } |
| 116 | 116 | ||
| 117 | var idtDirectory = Path.Combine(baseDirectory, "idts"); | ||
| 118 | Directory.CreateDirectory(idtDirectory); | ||
| 119 | |||
| 117 | try | 120 | try |
| 118 | { | 121 | { |
| 119 | OpenDatabase type = OpenDatabase.CreateDirect; | 122 | OpenDatabase type = OpenDatabase.CreateDirect; |
| @@ -128,20 +131,20 @@ namespace WixToolset.Core.WindowsInstaller.Bind | |||
| 128 | Console.WriteLine("Opening database at: {0}", this.OutputPath); | 131 | Console.WriteLine("Opening database at: {0}", this.OutputPath); |
| 129 | #endif | 132 | #endif |
| 130 | 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) | ||
| 132 | { | 136 | { |
| 133 | // Localize the codepage if a value was specified directly. | 137 | this.Output.Codepage = this.Codepage; |
| 134 | if (-1 != this.Codepage) | 138 | } |
| 135 | { | ||
| 136 | this.Output.Codepage = this.Codepage; | ||
| 137 | } | ||
| 138 | 139 | ||
| 140 | using (Database db = new Database(this.OutputPath, type)) | ||
| 141 | { | ||
| 139 | // if we're not using the default codepage, import a new one into our | 142 | // if we're not using the default codepage, import a new one into our |
| 140 | // database before we add any tables (or the tables would be added | 143 | // database before we add any tables (or the tables would be added |
| 141 | // with the wrong codepage). | 144 | // with the wrong codepage). |
| 142 | if (0 != this.Output.Codepage) | 145 | if (0 != this.Output.Codepage) |
| 143 | { | 146 | { |
| 144 | this.SetDatabaseCodepage(db, this.Output.Codepage); | 147 | this.SetDatabaseCodepage(db, this.Output.Codepage, idtDirectory); |
| 145 | } | 148 | } |
| 146 | 149 | ||
| 147 | foreach (Table table in this.Output.Tables) | 150 | foreach (Table table in this.Output.Tables) |
| @@ -179,8 +182,7 @@ namespace WixToolset.Core.WindowsInstaller.Bind | |||
| 179 | { | 182 | { |
| 180 | try | 183 | try |
| 181 | { | 184 | { |
| 182 | //db.ImportTable(this.Output.Codepage, importTable, baseDirectory, this.KeepAddedColumns); | 185 | var command = new CreateIdtFileCommand(this.Messaging, importTable, this.Output.Codepage, idtDirectory, this.KeepAddedColumns); |
| 183 | var command = new CreateIdtFileCommand(this.Messaging, importTable, this.Output.Codepage, baseDirectory, this.KeepAddedColumns); | ||
| 184 | command.Execute(); | 186 | command.Execute(); |
| 185 | 187 | ||
| 186 | db.Import(command.IdtPath); | 188 | db.Import(command.IdtPath); |
| @@ -351,15 +353,10 @@ namespace WixToolset.Core.WindowsInstaller.Bind | |||
| 351 | command.Execute(); | 353 | command.Execute(); |
| 352 | } | 354 | } |
| 353 | 355 | ||
| 354 | /// <summary> | 356 | private void SetDatabaseCodepage(Database db, int codepage, string idtDirectory) |
| 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) | ||
| 360 | { | 357 | { |
| 361 | // write out the _ForceCodepage IDT file | 358 | // write out the _ForceCodepage IDT file |
| 362 | string idtPath = Path.Combine(this.TempFilesLocation, "_ForceCodepage.idt"); | 359 | string idtPath = Path.Combine(idtDirectory, "_ForceCodepage.idt"); |
| 363 | using (StreamWriter idtFile = new StreamWriter(idtPath, false, Encoding.ASCII)) | 360 | using (StreamWriter idtFile = new StreamWriter(idtPath, false, Encoding.ASCII)) |
| 364 | { | 361 | { |
| 365 | idtFile.WriteLine(); // dummy column name record | 362 | idtFile.WriteLine(); // dummy column name record |
