aboutsummaryrefslogtreecommitdiff
path: root/src/WixToolset.Core/Librarian.cs
diff options
context:
space:
mode:
Diffstat (limited to 'src/WixToolset.Core/Librarian.cs')
-rw-r--r--src/WixToolset.Core/Librarian.cs30
1 files changed, 22 insertions, 8 deletions
diff --git a/src/WixToolset.Core/Librarian.cs b/src/WixToolset.Core/Librarian.cs
index a64d77dd..2efb0f9b 100644
--- a/src/WixToolset.Core/Librarian.cs
+++ b/src/WixToolset.Core/Librarian.cs
@@ -38,11 +38,14 @@ namespace WixToolset.Core
38 38
39 var sections = this.Context.Intermediates.SelectMany(i => i.Sections).ToList(); 39 var sections = this.Context.Intermediates.SelectMany(i => i.Sections).ToList();
40 40
41 var fileResolver = new FileResolver(this.Context.BindPaths, this.Context.Extensions); 41 var embedFilePaths = this.ResolveFilePathsToEmbed(sections);
42 42
43 var embedFilePaths = ResolveFilePathsToEmbed(sections, fileResolver); 43 var localizationsByCulture = this.CollateLocalizations(this.Context.Localizations);
44 44
45 var localizationsByCulture = CollateLocalizations(this.Context.Localizations); 45 if (this.Context.Messaging.EncounteredError)
46 {
47 return null;
48 }
46 49
47 foreach (var section in sections) 50 foreach (var section in sections)
48 { 51 {
@@ -83,7 +86,7 @@ namespace WixToolset.Core
83 return (this.Context.Messaging.EncounteredError ? null : library); 86 return (this.Context.Messaging.EncounteredError ? null : library);
84 } 87 }
85 88
86 private static Dictionary<string, Localization> CollateLocalizations(IEnumerable<Localization> localizations) 89 private Dictionary<string, Localization> CollateLocalizations(IEnumerable<Localization> localizations)
87 { 90 {
88 var localizationsByCulture = new Dictionary<string, Localization>(StringComparer.OrdinalIgnoreCase); 91 var localizationsByCulture = new Dictionary<string, Localization>(StringComparer.OrdinalIgnoreCase);
89 92
@@ -91,7 +94,14 @@ namespace WixToolset.Core
91 { 94 {
92 if (localizationsByCulture.TryGetValue(localization.Culture, out var existingCulture)) 95 if (localizationsByCulture.TryGetValue(localization.Culture, out var existingCulture))
93 { 96 {
94 existingCulture.Merge(localization); 97 try
98 {
99 existingCulture.Merge(localization);
100 }
101 catch (WixException e)
102 {
103 this.Context.Messaging.Write(e.Error);
104 }
95 } 105 }
96 else 106 else
97 { 107 {
@@ -102,13 +112,17 @@ namespace WixToolset.Core
102 return localizationsByCulture; 112 return localizationsByCulture;
103 } 113 }
104 114
105 private List<string> ResolveFilePathsToEmbed(IEnumerable<IntermediateSection> sections, FileResolver fileResolver) 115 private List<string> ResolveFilePathsToEmbed(IEnumerable<IntermediateSection> sections)
106 { 116 {
107 var embedFilePaths = new List<string>(); 117 var embedFilePaths = new List<string>();
108 118
109 // Resolve paths to files that are to be embedded in the library. 119 // Resolve paths to files that are to be embedded in the library.
110 if (this.Context.BindFiles) 120 if (this.Context.BindFiles)
111 { 121 {
122 var variableResolver = new WixVariableResolver(this.Context.Messaging);
123
124 var fileResolver = new FileResolver(this.Context.BindPaths, this.Context.Extensions);
125
112 foreach (var tuple in sections.SelectMany(s => s.Tuples)) 126 foreach (var tuple in sections.SelectMany(s => s.Tuples))
113 { 127 {
114 foreach (var field in tuple.Fields.Where(f => f.Type == IntermediateFieldType.Path)) 128 foreach (var field in tuple.Fields.Where(f => f.Type == IntermediateFieldType.Path))
@@ -117,9 +131,9 @@ namespace WixToolset.Core
117 131
118 if (pathField != null) 132 if (pathField != null)
119 { 133 {
120 var resolvedPath = this.Context.WixVariableResolver.ResolveVariables(tuple.SourceLineNumbers, pathField.Path, false); 134 var resolution = variableResolver.ResolveVariables(tuple.SourceLineNumbers, pathField.Path, false);
121 135
122 var file = fileResolver.Resolve(tuple.SourceLineNumbers, tuple.Definition.Name, resolvedPath); 136 var file = fileResolver.Resolve(tuple.SourceLineNumbers, tuple.Definition, resolution.Value);
123 137
124 if (!String.IsNullOrEmpty(file)) 138 if (!String.IsNullOrEmpty(file))
125 { 139 {