aboutsummaryrefslogtreecommitdiff
path: root/src/WixToolset.Core.WindowsInstaller/Bind/ExtractMergeModuleFilesCommand.cs
diff options
context:
space:
mode:
Diffstat (limited to 'src/WixToolset.Core.WindowsInstaller/Bind/ExtractMergeModuleFilesCommand.cs')
-rw-r--r--src/WixToolset.Core.WindowsInstaller/Bind/ExtractMergeModuleFilesCommand.cs66
1 files changed, 29 insertions, 37 deletions
diff --git a/src/WixToolset.Core.WindowsInstaller/Bind/ExtractMergeModuleFilesCommand.cs b/src/WixToolset.Core.WindowsInstaller/Bind/ExtractMergeModuleFilesCommand.cs
index 4105cb8f..5412c6f9 100644
--- a/src/WixToolset.Core.WindowsInstaller/Bind/ExtractMergeModuleFilesCommand.cs
+++ b/src/WixToolset.Core.WindowsInstaller/Bind/ExtractMergeModuleFilesCommand.cs
@@ -89,46 +89,38 @@ namespace WixToolset.Core.WindowsInstaller.Bind
89 using (View view = db.OpenExecuteView("SELECT `File`, `Directory_` FROM `File`, `Component` WHERE `Component_`=`Component`")) 89 using (View view = db.OpenExecuteView("SELECT `File`, `Directory_` FROM `File`, `Component` WHERE `Component_`=`Component`"))
90 { 90 {
91 // add each file row from the merge module into the file row collection (check for errors along the way) 91 // add each file row from the merge module into the file row collection (check for errors along the way)
92 while (true) 92 foreach (Record record in view.Records)
93 { 93 {
94 using (Record record = view.Fetch()) 94 // NOTE: this is very tricky - the merge module file rows are not added to the
95 // file table because they should not be created via idt import. Instead, these
96 // rows are created by merging in the actual modules.
97 var fileTuple = new FileTuple(wixMergeRow.SourceLineNumbers, new Identifier(AccessModifier.Private, record[1]));
98 fileTuple.Attributes = wixMergeRow.FileAttributes;
99 fileTuple.DirectoryRef = record[2];
100 fileTuple.DiskId = wixMergeRow.DiskId;
101 fileTuple.Source = new IntermediateFieldPathValue { Path = Path.Combine(this.IntermediateFolder, wixMergeRow.Id.Id, record[1]) };
102
103 var mergeModuleFileFacade = new FileFacade(true, fileTuple);
104
105 // If case-sensitive collision with another merge module or a user-authored file identifier.
106 if (indexedFileFacades.TryGetValue(mergeModuleFileFacade.File.Id.Id, out var collidingFacade))
95 { 107 {
96 if (null == record) 108 this.Messaging.Write(ErrorMessages.DuplicateModuleFileIdentifier(wixMergeRow.SourceLineNumbers, wixMergeRow.Id.Id, collidingFacade.File.Id.Id));
97 {
98 break;
99 }
100
101 // NOTE: this is very tricky - the merge module file rows are not added to the
102 // file table because they should not be created via idt import. Instead, these
103 // rows are created by merging in the actual modules.
104 var fileTuple = new FileTuple(wixMergeRow.SourceLineNumbers, new Identifier(AccessModifier.Private, record[1]));
105 fileTuple.Attributes = wixMergeRow.FileAttributes;
106 fileTuple.DirectoryRef = record[2];
107 fileTuple.DiskId = wixMergeRow.DiskId;
108 fileTuple.Source = new IntermediateFieldPathValue { Path = Path.Combine(this.IntermediateFolder, wixMergeRow.Id.Id, record[1]) };
109
110 var mergeModuleFileFacade = new FileFacade(true, fileTuple);
111
112 // If case-sensitive collision with another merge module or a user-authored file identifier.
113 if (indexedFileFacades.TryGetValue(mergeModuleFileFacade.File.Id.Id, out var collidingFacade))
114 {
115 this.Messaging.Write(ErrorMessages.DuplicateModuleFileIdentifier(wixMergeRow.SourceLineNumbers, wixMergeRow.Id.Id, collidingFacade.File.Id.Id));
116 }
117 else if (uniqueModuleFileIdentifiers.TryGetValue(mergeModuleFileFacade.File.Id.Id, out collidingFacade)) // case-insensitive collision with another file identifier in the same merge module
118 {
119 this.Messaging.Write(ErrorMessages.DuplicateModuleCaseInsensitiveFileIdentifier(wixMergeRow.SourceLineNumbers, wixMergeRow.Id.Id, mergeModuleFileFacade.File.Id.Id, collidingFacade.File.Id.Id));
120 }
121 else // no collision
122 {
123 mergeModulesFileFacades.Add(mergeModuleFileFacade);
124
125 // Keep updating the indexes as new rows are added.
126 indexedFileFacades.Add(mergeModuleFileFacade.File.Id.Id, mergeModuleFileFacade);
127 uniqueModuleFileIdentifiers.Add(mergeModuleFileFacade.File.Id.Id, mergeModuleFileFacade);
128 }
129
130 containsFiles = true;
131 } 109 }
110 else if (uniqueModuleFileIdentifiers.TryGetValue(mergeModuleFileFacade.File.Id.Id, out collidingFacade)) // case-insensitive collision with another file identifier in the same merge module
111 {
112 this.Messaging.Write(ErrorMessages.DuplicateModuleCaseInsensitiveFileIdentifier(wixMergeRow.SourceLineNumbers, wixMergeRow.Id.Id, mergeModuleFileFacade.File.Id.Id, collidingFacade.File.Id.Id));
113 }
114 else // no collision
115 {
116 mergeModulesFileFacades.Add(mergeModuleFileFacade);
117
118 // Keep updating the indexes as new rows are added.
119 indexedFileFacades.Add(mergeModuleFileFacade.File.Id.Id, mergeModuleFileFacade);
120 uniqueModuleFileIdentifiers.Add(mergeModuleFileFacade.File.Id.Id, mergeModuleFileFacade);
121 }
122
123 containsFiles = true;
132 } 124 }
133 } 125 }
134 } 126 }