diff options
author | Rob Mensching <rob@firegiant.com> | 2020-07-05 23:27:10 -0700 |
---|---|---|
committer | Rob Mensching <rob@firegiant.com> | 2020-07-12 17:29:45 -0700 |
commit | 92bb1d2d74e46714459c2d0fc23f185329745718 (patch) | |
tree | c9aedf747c9e3735ac95df0d743077ecb9f9c1f3 /src | |
parent | 3f0af880a3d8a41e1a6ac342f8fba06d22b223a0 (diff) | |
download | wix-92bb1d2d74e46714459c2d0fc23f185329745718.tar.gz wix-92bb1d2d74e46714459c2d0fc23f185329745718.tar.bz2 wix-92bb1d2d74e46714459c2d0fc23f185329745718.zip |
Store short filenames in separate fields
Diffstat (limited to 'src')
-rw-r--r-- | src/WixToolset.Converters.Symbolizer/ConvertSymbols.cs | 62 | ||||
-rw-r--r-- | src/test/WixToolsetTest.Converters.Symbolizer/ConvertSymbolsFixture.cs | 2 |
2 files changed, 57 insertions, 7 deletions
diff --git a/src/WixToolset.Converters.Symbolizer/ConvertSymbols.cs b/src/WixToolset.Converters.Symbolizer/ConvertSymbols.cs index 76a0440f..ca75d3c2 100644 --- a/src/WixToolset.Converters.Symbolizer/ConvertSymbols.cs +++ b/src/WixToolset.Converters.Symbolizer/ConvertSymbols.cs | |||
@@ -197,7 +197,20 @@ namespace WixToolset.Converters.Symbolizer | |||
197 | case "DrLocator": | 197 | case "DrLocator": |
198 | return DefaultSymbolFromRow(typeof(DrLocatorSymbol), row, columnZeroIsId: false); | 198 | return DefaultSymbolFromRow(typeof(DrLocatorSymbol), row, columnZeroIsId: false); |
199 | case "DuplicateFile": | 199 | case "DuplicateFile": |
200 | return DefaultSymbolFromRow(typeof(DuplicateFileSymbol), row, columnZeroIsId: true); | 200 | { |
201 | var splitName = FieldAsString(row, 3)?.Split('|'); | ||
202 | |||
203 | var symbol = new DuplicateFileSymbol(SourceLineNumber4(row.SourceLineNumbers), new Identifier(AccessModifier.Public, FieldAsString(row, 0))) | ||
204 | { | ||
205 | ComponentRef = FieldAsString(row, 1), | ||
206 | FileRef = FieldAsString(row, 2), | ||
207 | DestinationName = splitName == null ? null : splitName.Length > 1 ? splitName[1] : splitName[0], | ||
208 | DestinationShortName = splitName == null ? null : splitName.Length > 1 ? splitName[0] : null, | ||
209 | DestinationFolder = FieldAsString(row, 4) | ||
210 | }; | ||
211 | |||
212 | return symbol; | ||
213 | } | ||
201 | case "Error": | 214 | case "Error": |
202 | return DefaultSymbolFromRow(typeof(ErrorSymbol), row, columnZeroIsId: false); | 215 | return DefaultSymbolFromRow(typeof(ErrorSymbol), row, columnZeroIsId: false); |
203 | case "Extension": | 216 | case "Extension": |
@@ -246,11 +259,13 @@ namespace WixToolset.Converters.Symbolizer | |||
246 | symbolAttributes |= (attributes & WindowsInstallerConstants.MsidbFileAttributesCompressed) == WindowsInstallerConstants.MsidbFileAttributesCompressed ? FileSymbolAttributes.Compressed : 0; | 259 | symbolAttributes |= (attributes & WindowsInstallerConstants.MsidbFileAttributesCompressed) == WindowsInstallerConstants.MsidbFileAttributesCompressed ? FileSymbolAttributes.Compressed : 0; |
247 | 260 | ||
248 | var id = FieldAsString(row, 0); | 261 | var id = FieldAsString(row, 0); |
262 | var splitName = FieldAsString(row, 2).Split('|'); | ||
249 | 263 | ||
250 | var symbol = new FileSymbol(SourceLineNumber4(row.SourceLineNumbers), new Identifier(AccessModifier.Public, id)) | 264 | var symbol = new FileSymbol(SourceLineNumber4(row.SourceLineNumbers), new Identifier(AccessModifier.Public, id)) |
251 | { | 265 | { |
252 | ComponentRef = FieldAsString(row, 1), | 266 | ComponentRef = FieldAsString(row, 1), |
253 | Name = FieldAsString(row, 2), | 267 | Name = splitName.Length > 1 ? splitName[1] : splitName[0], |
268 | ShortName = splitName.Length > 1 ? splitName[0] : null, | ||
254 | FileSize = FieldAsInt(row, 3), | 269 | FileSize = FieldAsInt(row, 3), |
255 | Version = FieldAsString(row, 4), | 270 | Version = FieldAsString(row, 4), |
256 | Language = FieldAsString(row, 5), | 271 | Language = FieldAsString(row, 5), |
@@ -278,7 +293,6 @@ namespace WixToolset.Converters.Symbolizer | |||
278 | symbol.DiskId = FieldAsNullableInt(wixFileRow, 5) ?? 0; | 293 | symbol.DiskId = FieldAsNullableInt(wixFileRow, 5) ?? 0; |
279 | symbol.Source = new IntermediateFieldPathValue { Path = FieldAsString(wixFileRow, 6) }; | 294 | symbol.Source = new IntermediateFieldPathValue { Path = FieldAsString(wixFileRow, 6) }; |
280 | symbol.PatchGroup = FieldAsInt(wixFileRow, 8); | 295 | symbol.PatchGroup = FieldAsInt(wixFileRow, 8); |
281 | symbol.Attributes |= FieldAsInt(wixFileRow, 9) != 0 ? FileSymbolAttributes.GeneratedShortFileName : 0; | ||
282 | symbol.PatchAttributes = (PatchAttributeType)FieldAsInt(wixFileRow, 10); | 296 | symbol.PatchAttributes = (PatchAttributeType)FieldAsInt(wixFileRow, 10); |
283 | } | 297 | } |
284 | 298 | ||
@@ -288,8 +302,41 @@ namespace WixToolset.Converters.Symbolizer | |||
288 | return null; | 302 | return null; |
289 | case "Icon": | 303 | case "Icon": |
290 | return DefaultSymbolFromRow(typeof(IconSymbol), row, columnZeroIsId: true); | 304 | return DefaultSymbolFromRow(typeof(IconSymbol), row, columnZeroIsId: true); |
305 | case "IniFile": | ||
306 | { | ||
307 | var splitName = FieldAsString(row, 1).Split('|'); | ||
308 | var action = FieldAsInt(row, 6); | ||
309 | |||
310 | var symbol = new IniFileSymbol(SourceLineNumber4(row.SourceLineNumbers), new Identifier(AccessModifier.Public, FieldAsString(row, 0))) | ||
311 | { | ||
312 | FileName = splitName.Length > 1 ? splitName[1] : splitName[0], | ||
313 | ShortFileName = splitName.Length > 1 ? splitName[0] : null, | ||
314 | DirProperty = FieldAsString(row, 2), | ||
315 | Section = FieldAsString(row, 3), | ||
316 | Key = FieldAsString(row, 4), | ||
317 | Value = FieldAsString(row, 5), | ||
318 | Action = action == 3 ? InifFileActionType.AddTag : action == 1 ? InifFileActionType.CreateLine : InifFileActionType.AddLine, | ||
319 | ComponentRef = FieldAsString(row, 7), | ||
320 | }; | ||
321 | |||
322 | return symbol; | ||
323 | } | ||
291 | case "IniLocator": | 324 | case "IniLocator": |
292 | return DefaultSymbolFromRow(typeof(IniLocatorSymbol), row, columnZeroIsId: false); | 325 | { |
326 | var splitName = FieldAsString(row, 1).Split('|'); | ||
327 | |||
328 | var symbol = new IniLocatorSymbol(SourceLineNumber4(row.SourceLineNumbers), new Identifier(AccessModifier.Public, FieldAsString(row, 0))) | ||
329 | { | ||
330 | FileName = splitName.Length > 1 ? splitName[1] : splitName[0], | ||
331 | ShortFileName = splitName.Length > 1 ? splitName[0] : null, | ||
332 | Section = FieldAsString(row, 2), | ||
333 | Key = FieldAsString(row, 3), | ||
334 | Field = FieldAsInt(row, 4), | ||
335 | Type = FieldAsInt(row, 5), | ||
336 | }; | ||
337 | |||
338 | return symbol; | ||
339 | } | ||
293 | case "LockPermissions": | 340 | case "LockPermissions": |
294 | return DefaultSymbolFromRow(typeof(LockPermissionsSymbol), row, columnZeroIsId: false); | 341 | return DefaultSymbolFromRow(typeof(LockPermissionsSymbol), row, columnZeroIsId: false); |
295 | case "Media": | 342 | case "Media": |
@@ -423,12 +470,15 @@ namespace WixToolset.Converters.Symbolizer | |||
423 | } | 470 | } |
424 | case "RemoveFile": | 471 | case "RemoveFile": |
425 | { | 472 | { |
473 | var splitName = FieldAsString(row, 2).Split('|'); | ||
426 | var installMode = FieldAsInt(row, 4); | 474 | var installMode = FieldAsInt(row, 4); |
475 | |||
427 | return new RemoveFileSymbol(SourceLineNumber4(row.SourceLineNumbers), new Identifier(AccessModifier.Public, FieldAsString(row, 0))) | 476 | return new RemoveFileSymbol(SourceLineNumber4(row.SourceLineNumbers), new Identifier(AccessModifier.Public, FieldAsString(row, 0))) |
428 | { | 477 | { |
429 | ComponentRef = FieldAsString(row, 1), | 478 | ComponentRef = FieldAsString(row, 1), |
430 | FileName = FieldAsString(row, 2), | 479 | FileName = splitName.Length > 1 ? splitName[1] : splitName[0], |
431 | DirProperty = FieldAsString(row, 3), | 480 | ShortFileName = splitName.Length > 1 ? splitName[0] : null, |
481 | DirPropertyRef = FieldAsString(row, 3), | ||
432 | OnInstall = (installMode & WindowsInstallerConstants.MsidbRemoveFileInstallModeOnInstall) == WindowsInstallerConstants.MsidbRemoveFileInstallModeOnInstall ? (bool?)true : null, | 482 | OnInstall = (installMode & WindowsInstallerConstants.MsidbRemoveFileInstallModeOnInstall) == WindowsInstallerConstants.MsidbRemoveFileInstallModeOnInstall ? (bool?)true : null, |
433 | OnUninstall = (installMode & WindowsInstallerConstants.MsidbRemoveFileInstallModeOnRemove) == WindowsInstallerConstants.MsidbRemoveFileInstallModeOnRemove ? (bool?)true : null | 483 | OnUninstall = (installMode & WindowsInstallerConstants.MsidbRemoveFileInstallModeOnRemove) == WindowsInstallerConstants.MsidbRemoveFileInstallModeOnRemove ? (bool?)true : null |
434 | }; | 484 | }; |
diff --git a/src/test/WixToolsetTest.Converters.Symbolizer/ConvertSymbolsFixture.cs b/src/test/WixToolsetTest.Converters.Symbolizer/ConvertSymbolsFixture.cs index ae054079..01213524 100644 --- a/src/test/WixToolsetTest.Converters.Symbolizer/ConvertSymbolsFixture.cs +++ b/src/test/WixToolsetTest.Converters.Symbolizer/ConvertSymbolsFixture.cs | |||
@@ -317,7 +317,7 @@ namespace WixToolsetTest.Converters.Symbolizer | |||
317 | fileSymbol.Source.Path, | 317 | fileSymbol.Source.Path, |
318 | null, // assembly processor arch | 318 | null, // assembly processor arch |
319 | fileSymbol.PatchGroup, | 319 | fileSymbol.PatchGroup, |
320 | (fileSymbol.Attributes & FileSymbolAttributes.GeneratedShortFileName) != 0 ? 1 : 0, | 320 | 0, |
321 | (int)fileSymbol.PatchAttributes, | 321 | (int)fileSymbol.PatchAttributes, |
322 | fileSymbol.RetainLengths, | 322 | fileSymbol.RetainLengths, |
323 | fileSymbol.IgnoreOffsets, | 323 | fileSymbol.IgnoreOffsets, |