diff options
| author | Bob Arnson <bob@firegiant.com> | 2020-02-06 22:04:55 -0500 |
|---|---|---|
| committer | Bob Arnson <bob@firegiant.com> | 2020-02-07 22:00:52 -0500 |
| commit | 57559c253fe8ec6f9c66662d11fbcabccc3ba057 (patch) | |
| tree | 60c7b4da6bbb6fe0090498e60fdfbcb769a1af0b /src/WixToolset.Core.WindowsInstaller | |
| parent | 9feb0090d2cdd0979bea90ba9aa13dc541f47054 (diff) | |
| download | wix-57559c253fe8ec6f9c66662d11fbcabccc3ba057.tar.gz wix-57559c253fe8ec6f9c66662d11fbcabccc3ba057.tar.bz2 wix-57559c253fe8ec6f9c66662d11fbcabccc3ba057.zip | |
Add CreateFolder tuples for null-keypath components in the backend instead of the compiler.
Diffstat (limited to 'src/WixToolset.Core.WindowsInstaller')
| -rw-r--r-- | src/WixToolset.Core.WindowsInstaller/Bind/AddCreateFoldersCommand.cs | 40 | ||||
| -rw-r--r-- | src/WixToolset.Core.WindowsInstaller/Bind/BindDatabaseCommand.cs | 6 |
2 files changed, 46 insertions, 0 deletions
diff --git a/src/WixToolset.Core.WindowsInstaller/Bind/AddCreateFoldersCommand.cs b/src/WixToolset.Core.WindowsInstaller/Bind/AddCreateFoldersCommand.cs new file mode 100644 index 00000000..6cc4153f --- /dev/null +++ b/src/WixToolset.Core.WindowsInstaller/Bind/AddCreateFoldersCommand.cs | |||
| @@ -0,0 +1,40 @@ | |||
| 1 | // Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. | ||
| 2 | |||
| 3 | namespace WixToolset.Core.WindowsInstaller.Bind | ||
| 4 | { | ||
| 5 | using System.Collections.Generic; | ||
| 6 | using System.Linq; | ||
| 7 | using WixToolset.Data; | ||
| 8 | using WixToolset.Data.Tuples; | ||
| 9 | |||
| 10 | /// <summary> | ||
| 11 | /// Add CreateFolder tuples, if not already present, for null-keypath components. | ||
| 12 | /// </summary> | ||
| 13 | internal class AddCreateFoldersCommand | ||
| 14 | { | ||
| 15 | internal AddCreateFoldersCommand(IntermediateSection section) | ||
| 16 | { | ||
| 17 | this.Section = section; | ||
| 18 | } | ||
| 19 | |||
| 20 | private IntermediateSection Section { get; } | ||
| 21 | |||
| 22 | public void Execute() | ||
| 23 | { | ||
| 24 | var createFolderTuplesByComponentRef = new HashSet<string>(this.Section.Tuples.OfType<CreateFolderTuple>().Select(t => t.ComponentRef)); | ||
| 25 | foreach (var componentTuple in this.Section.Tuples.OfType<ComponentTuple>().Where(t => t.KeyPathType == ComponentKeyPathType.Directory).ToList()) | ||
| 26 | { | ||
| 27 | if (!createFolderTuplesByComponentRef.Contains(componentTuple.Id.Id)) | ||
| 28 | { | ||
| 29 | var createFolderTuple = new CreateFolderTuple(componentTuple.SourceLineNumbers) | ||
| 30 | { | ||
| 31 | DirectoryRef = componentTuple.DirectoryRef, | ||
| 32 | ComponentRef = componentTuple.Id.Id, | ||
| 33 | }; | ||
| 34 | |||
| 35 | this.Section.Tuples.Add(createFolderTuple); | ||
| 36 | } | ||
| 37 | } | ||
| 38 | } | ||
| 39 | } | ||
| 40 | } \ No newline at end of file | ||
diff --git a/src/WixToolset.Core.WindowsInstaller/Bind/BindDatabaseCommand.cs b/src/WixToolset.Core.WindowsInstaller/Bind/BindDatabaseCommand.cs index 34104ef5..1bcaf209 100644 --- a/src/WixToolset.Core.WindowsInstaller/Bind/BindDatabaseCommand.cs +++ b/src/WixToolset.Core.WindowsInstaller/Bind/BindDatabaseCommand.cs | |||
| @@ -338,6 +338,12 @@ namespace WixToolset.Core.WindowsInstaller.Bind | |||
| 338 | command.Execute(); | 338 | command.Execute(); |
| 339 | } | 339 | } |
| 340 | 340 | ||
| 341 | // Add missing CreateFolder tuples to null-keypath components. | ||
| 342 | { | ||
| 343 | var command = new AddCreateFoldersCommand(section); | ||
| 344 | command.Execute(); | ||
| 345 | } | ||
| 346 | |||
| 341 | // stop processing if an error previously occurred | 347 | // stop processing if an error previously occurred |
| 342 | if (this.Messaging.EncounteredError) | 348 | if (this.Messaging.EncounteredError) |
| 343 | { | 349 | { |
