diff options
| author | Rob Mensching <rob@firegiant.com> | 2019-05-24 08:49:18 -0700 |
|---|---|---|
| committer | Rob Mensching <rob@firegiant.com> | 2019-10-07 11:59:14 -0700 |
| commit | 9170d12eed6fbb0af88963f71fdc661bdcecfd58 (patch) | |
| tree | 7a9afe636b97a0a723047d9bef6c8c21ef864412 /src | |
| parent | 7eb811f1674f210564179254807c7ad9d62b5eab (diff) | |
| download | wix-9170d12eed6fbb0af88963f71fdc661bdcecfd58.tar.gz wix-9170d12eed6fbb0af88963f71fdc661bdcecfd58.tar.bz2 wix-9170d12eed6fbb0af88963f71fdc661bdcecfd58.zip | |
Handle null path fields during Resolve
Also rename more "row" to "tuple"
Diffstat (limited to 'src')
| -rw-r--r-- | src/WixToolset.Core/Bind/ResolveFieldsCommand.cs | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/src/WixToolset.Core/Bind/ResolveFieldsCommand.cs b/src/WixToolset.Core/Bind/ResolveFieldsCommand.cs index 6c9f17dd..2c213402 100644 --- a/src/WixToolset.Core/Bind/ResolveFieldsCommand.cs +++ b/src/WixToolset.Core/Bind/ResolveFieldsCommand.cs | |||
| @@ -36,17 +36,17 @@ namespace WixToolset.Core.Bind | |||
| 36 | 36 | ||
| 37 | public void Execute() | 37 | public void Execute() |
| 38 | { | 38 | { |
| 39 | List<DelayedField> delayedFields = this.SupportDelayedResolution ? new List<DelayedField>() : null; | 39 | var delayedFields = this.SupportDelayedResolution ? new List<DelayedField>() : null; |
| 40 | 40 | ||
| 41 | var fileResolver = new FileResolver(this.BindPaths, this.Extensions); | 41 | var fileResolver = new FileResolver(this.BindPaths, this.Extensions); |
| 42 | 42 | ||
| 43 | foreach (var sections in this.Intermediate.Sections) | 43 | foreach (var sections in this.Intermediate.Sections) |
| 44 | { | 44 | { |
| 45 | foreach (var row in sections.Tuples) | 45 | foreach (var tuple in sections.Tuples) |
| 46 | { | 46 | { |
| 47 | foreach (var field in row.Fields) | 47 | foreach (var field in tuple.Fields) |
| 48 | { | 48 | { |
| 49 | if (field == null) | 49 | if (field.IsNull()) |
| 50 | { | 50 | { |
| 51 | continue; | 51 | continue; |
| 52 | } | 52 | } |
| @@ -62,7 +62,7 @@ namespace WixToolset.Core.Bind | |||
| 62 | var original = field.AsString(); | 62 | var original = field.AsString(); |
| 63 | if (!String.IsNullOrEmpty(original)) | 63 | if (!String.IsNullOrEmpty(original)) |
| 64 | { | 64 | { |
| 65 | var resolution = this.VariableResolver.ResolveVariables(row.SourceLineNumbers, original, false); | 65 | var resolution = this.VariableResolver.ResolveVariables(tuple.SourceLineNumbers, original, false); |
| 66 | if (resolution.UpdatedValue) | 66 | if (resolution.UpdatedValue) |
| 67 | { | 67 | { |
| 68 | field.Set(resolution.Value); | 68 | field.Set(resolution.Value); |
| @@ -70,7 +70,7 @@ namespace WixToolset.Core.Bind | |||
| 70 | 70 | ||
| 71 | if (resolution.DelayedResolve) | 71 | if (resolution.DelayedResolve) |
| 72 | { | 72 | { |
| 73 | delayedFields.Add(new DelayedField(row, field)); | 73 | delayedFields.Add(new DelayedField(tuple, field)); |
| 74 | } | 74 | } |
| 75 | 75 | ||
| 76 | isDefault = resolution.IsDefault; | 76 | isDefault = resolution.IsDefault; |
| @@ -78,7 +78,7 @@ namespace WixToolset.Core.Bind | |||
| 78 | } | 78 | } |
| 79 | } | 79 | } |
| 80 | 80 | ||
| 81 | // Move to next row if we've hit an error resolving variables. | 81 | // Move to next tuple if we've hit an error resolving variables. |
| 82 | if (this.Messaging.EncounteredError) // TODO: make this error handling more specific to just the failure to resolve variables in this field. | 82 | if (this.Messaging.EncounteredError) // TODO: make this error handling more specific to just the failure to resolve variables in this field. |
| 83 | { | 83 | { |
| 84 | continue; | 84 | continue; |
| @@ -91,7 +91,7 @@ namespace WixToolset.Core.Bind | |||
| 91 | 91 | ||
| 92 | #if REVISIT_FOR_PATCHING | 92 | #if REVISIT_FOR_PATCHING |
| 93 | // Skip file resolution if the file is to be deleted. | 93 | // Skip file resolution if the file is to be deleted. |
| 94 | if (RowOperation.Delete == row.Operation) | 94 | if (RowOperation.Delete == tuple.Operation) |
| 95 | { | 95 | { |
| 96 | continue; | 96 | continue; |
| 97 | } | 97 | } |
| @@ -120,13 +120,13 @@ namespace WixToolset.Core.Bind | |||
| 120 | #endif | 120 | #endif |
| 121 | 121 | ||
| 122 | // resolve the path to the file | 122 | // resolve the path to the file |
| 123 | var value = fileResolver.ResolveFile(objectField.Path, row.Definition, row.SourceLineNumbers, BindStage.Normal); | 123 | var value = fileResolver.ResolveFile(objectField.Path, tuple.Definition, tuple.SourceLineNumbers, BindStage.Normal); |
| 124 | field.Set(value); | 124 | field.Set(value); |
| 125 | } | 125 | } |
| 126 | else if (!fileResolver.RebaseTarget && !fileResolver.RebaseUpdated) // Normal binding for Patch Scenario (normal patch, no re-basing logic) | 126 | else if (!fileResolver.RebaseTarget && !fileResolver.RebaseUpdated) // Normal binding for Patch Scenario (normal patch, no re-basing logic) |
| 127 | { | 127 | { |
| 128 | // resolve the path to the file | 128 | // resolve the path to the file |
| 129 | var value = fileResolver.ResolveFile(objectField.Path, row.Definition, row.SourceLineNumbers, BindStage.Normal); | 129 | var value = fileResolver.ResolveFile(objectField.Path, tuple.Definition, tuple.SourceLineNumbers, BindStage.Normal); |
| 130 | field.Set(value); | 130 | field.Set(value); |
| 131 | } | 131 | } |
| 132 | #if REVISIT_FOR_PATCHING | 132 | #if REVISIT_FOR_PATCHING |
| @@ -148,7 +148,7 @@ namespace WixToolset.Core.Bind | |||
| 148 | } | 148 | } |
| 149 | } | 149 | } |
| 150 | 150 | ||
| 151 | objectField.Data = fileResolver.ResolveFile(filePathToResolve, row.Definition.Name, row.SourceLineNumbers, BindStage.Updated); | 151 | objectField.Data = fileResolver.ResolveFile(filePathToResolve, tuple.Definition.Name, tuple.SourceLineNumbers, BindStage.Updated); |
| 152 | } | 152 | } |
| 153 | #endif | 153 | #endif |
| 154 | } | 154 | } |
| @@ -161,7 +161,7 @@ namespace WixToolset.Core.Bind | |||
| 161 | #if REVISIT_FOR_PATCHING | 161 | #if REVISIT_FOR_PATCHING |
| 162 | if (null != objectField.PreviousData) | 162 | if (null != objectField.PreviousData) |
| 163 | { | 163 | { |
| 164 | objectField.PreviousData = this.BindVariableResolver.ResolveVariables(row.SourceLineNumbers, objectField.PreviousData, false, out isDefault); | 164 | objectField.PreviousData = this.BindVariableResolver.ResolveVariables(tuple.SourceLineNumbers, objectField.PreviousData, false, out isDefault); |
| 165 | 165 | ||
| 166 | if (!Messaging.Instance.EncounteredError) // TODO: make this error handling more specific to just the failure to resolve variables in this field. | 166 | if (!Messaging.Instance.EncounteredError) // TODO: make this error handling more specific to just the failure to resolve variables in this field. |
| 167 | { | 167 | { |
| @@ -186,7 +186,7 @@ namespace WixToolset.Core.Bind | |||
| 186 | if (!fileResolver.RebaseTarget && !fileResolver.RebaseUpdated) | 186 | if (!fileResolver.RebaseTarget && !fileResolver.RebaseUpdated) |
| 187 | { | 187 | { |
| 188 | // resolve the path to the file | 188 | // resolve the path to the file |
| 189 | objectField.PreviousData = fileResolver.ResolveFile((string)objectField.PreviousData, row.Definition.Name, row.SourceLineNumbers, BindStage.Normal); | 189 | objectField.PreviousData = fileResolver.ResolveFile((string)objectField.PreviousData, tuple.Definition.Name, tuple.SourceLineNumbers, BindStage.Normal); |
| 190 | } | 190 | } |
| 191 | else | 191 | else |
| 192 | { | 192 | { |
| @@ -204,14 +204,14 @@ namespace WixToolset.Core.Bind | |||
| 204 | } | 204 | } |
| 205 | 205 | ||
| 206 | // resolve the path to the file | 206 | // resolve the path to the file |
| 207 | objectField.PreviousData = fileResolver.ResolveFile((string)objectField.PreviousData, row.Definition.Name, row.SourceLineNumbers, BindStage.Target); | 207 | objectField.PreviousData = fileResolver.ResolveFile((string)objectField.PreviousData, tuple.Definition.Name, tuple.SourceLineNumbers, BindStage.Target); |
| 208 | 208 | ||
| 209 | } | 209 | } |
| 210 | } | 210 | } |
| 211 | catch (WixFileNotFoundException) | 211 | catch (WixFileNotFoundException) |
| 212 | { | 212 | { |
| 213 | // display the error with source line information | 213 | // display the error with source line information |
| 214 | Messaging.Instance.Write(WixErrors.FileNotFound(row.SourceLineNumbers, (string)objectField.PreviousData)); | 214 | Messaging.Instance.Write(WixErrors.FileNotFound(tuple.SourceLineNumbers, (string)objectField.PreviousData)); |
| 215 | } | 215 | } |
| 216 | } | 216 | } |
| 217 | } | 217 | } |
