diff options
Diffstat (limited to 'src/tools/heat')
-rw-r--r-- | src/tools/heat/UtilFinalizeHarvesterMutator.cs | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/src/tools/heat/UtilFinalizeHarvesterMutator.cs b/src/tools/heat/UtilFinalizeHarvesterMutator.cs index 61bb8731..d41d6e1e 100644 --- a/src/tools/heat/UtilFinalizeHarvesterMutator.cs +++ b/src/tools/heat/UtilFinalizeHarvesterMutator.cs | |||
@@ -25,6 +25,7 @@ namespace WixToolset.Harvesters | |||
25 | private Hashtable filePaths; | 25 | private Hashtable filePaths; |
26 | private ArrayList files; | 26 | private ArrayList files; |
27 | private ArrayList registryValues; | 27 | private ArrayList registryValues; |
28 | private List<Wix.Payload> payloads; | ||
28 | private bool suppressCOMElements; | 29 | private bool suppressCOMElements; |
29 | private bool suppressVB6COMElements; | 30 | private bool suppressVB6COMElements; |
30 | private string preprocessorVariable; | 31 | private string preprocessorVariable; |
@@ -40,6 +41,7 @@ namespace WixToolset.Harvesters | |||
40 | this.filePaths = new Hashtable(); | 41 | this.filePaths = new Hashtable(); |
41 | this.files = new ArrayList(); | 42 | this.files = new ArrayList(); |
42 | this.registryValues = new ArrayList(); | 43 | this.registryValues = new ArrayList(); |
44 | this.payloads = new List<Wix.Payload>(); | ||
43 | } | 45 | } |
44 | 46 | ||
45 | /// <summary> | 47 | /// <summary> |
@@ -93,6 +95,7 @@ namespace WixToolset.Harvesters | |||
93 | this.filePaths.Clear(); | 95 | this.filePaths.Clear(); |
94 | this.files.Clear(); | 96 | this.files.Clear(); |
95 | this.registryValues.Clear(); | 97 | this.registryValues.Clear(); |
98 | this.payloads.Clear(); | ||
96 | 99 | ||
97 | // index elements in this wix document | 100 | // index elements in this wix document |
98 | this.IndexElement(wix); | 101 | this.IndexElement(wix); |
@@ -100,6 +103,7 @@ namespace WixToolset.Harvesters | |||
100 | this.MutateDirectories(); | 103 | this.MutateDirectories(); |
101 | this.MutateFiles(); | 104 | this.MutateFiles(); |
102 | this.MutateRegistryValues(); | 105 | this.MutateRegistryValues(); |
106 | this.MutatePayloads(); | ||
103 | 107 | ||
104 | // must occur after all the registry values have been formatted | 108 | // must occur after all the registry values have been formatted |
105 | this.MutateComponents(); | 109 | this.MutateComponents(); |
@@ -131,6 +135,10 @@ namespace WixToolset.Harvesters | |||
131 | { | 135 | { |
132 | this.registryValues.Add(element); | 136 | this.registryValues.Add(element); |
133 | } | 137 | } |
138 | else if (element is Wix.Payload payloadElement) | ||
139 | { | ||
140 | this.payloads.Add(payloadElement); | ||
141 | } | ||
134 | 142 | ||
135 | // index the child elements | 143 | // index the child elements |
136 | if (element is Wix.IParentElement) | 144 | if (element is Wix.IParentElement) |
@@ -1006,6 +1014,33 @@ namespace WixToolset.Harvesters | |||
1006 | } | 1014 | } |
1007 | 1015 | ||
1008 | /// <summary> | 1016 | /// <summary> |
1017 | /// Mutate the payloads. | ||
1018 | /// </summary> | ||
1019 | private void MutatePayloads() | ||
1020 | { | ||
1021 | string sourceDirSubstitution = this.preprocessorVariable; | ||
1022 | if (sourceDirSubstitution == null) | ||
1023 | { | ||
1024 | return; | ||
1025 | } | ||
1026 | |||
1027 | string prefix = "$("; | ||
1028 | if (sourceDirSubstitution.StartsWith("wix.", StringComparison.Ordinal)) | ||
1029 | { | ||
1030 | prefix = "!("; | ||
1031 | } | ||
1032 | sourceDirSubstitution = String.Concat(prefix, sourceDirSubstitution, ")"); | ||
1033 | |||
1034 | foreach (var payload in this.payloads) | ||
1035 | { | ||
1036 | if (payload.SourceFile != null && payload.SourceFile.StartsWith("SourceDir\\", StringComparison.Ordinal)) | ||
1037 | { | ||
1038 | payload.SourceFile = payload.SourceFile.Substring(9).Insert(0, sourceDirSubstitution); | ||
1039 | } | ||
1040 | } | ||
1041 | } | ||
1042 | |||
1043 | /// <summary> | ||
1009 | /// Mutate an individual registry string, according to a collection of replacement items. | 1044 | /// Mutate an individual registry string, according to a collection of replacement items. |
1010 | /// </summary> | 1045 | /// </summary> |
1011 | /// <param name="value">The string to mutate.</param> | 1046 | /// <param name="value">The string to mutate.</param> |