diff options
| author | Rob Mensching <rob@firegiant.com> | 2021-04-06 09:34:57 -0700 |
|---|---|---|
| committer | Rob Mensching <rob@firegiant.com> | 2021-04-06 16:10:05 -0700 |
| commit | 86e59fdbc94ae661ca682f04cddb60d7830ae8a8 (patch) | |
| tree | 227b19100f4f116abdd4b4996688a86d58ad3d32 /src/WixToolset.Core/Compiler.cs | |
| parent | 860f77f7c9d522074dc7e44cfe11281efd20687f (diff) | |
| download | wix-86e59fdbc94ae661ca682f04cddb60d7830ae8a8.tar.gz wix-86e59fdbc94ae661ca682f04cddb60d7830ae8a8.tar.bz2 wix-86e59fdbc94ae661ca682f04cddb60d7830ae8a8.zip | |
Introduce StandardDirectory for referencing standard directories
Completes wixtoolset/issues#6416
Diffstat (limited to 'src/WixToolset.Core/Compiler.cs')
| -rw-r--r-- | src/WixToolset.Core/Compiler.cs | 72 |
1 files changed, 72 insertions, 0 deletions
diff --git a/src/WixToolset.Core/Compiler.cs b/src/WixToolset.Core/Compiler.cs index 184c5b3e..ca9385f6 100644 --- a/src/WixToolset.Core/Compiler.cs +++ b/src/WixToolset.Core/Compiler.cs | |||
| @@ -4427,6 +4427,10 @@ namespace WixToolset.Core | |||
| 4427 | { | 4427 | { |
| 4428 | this.Core.Write(ErrorMessages.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Id")); | 4428 | this.Core.Write(ErrorMessages.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Id")); |
| 4429 | } | 4429 | } |
| 4430 | else if (WindowsInstallerStandard.IsStandardDirectory(id)) | ||
| 4431 | { | ||
| 4432 | this.Core.Write(CompilerWarnings.DirectoryRefStandardDirectoryDeprecated(sourceLineNumbers, id)); | ||
| 4433 | } | ||
| 4430 | 4434 | ||
| 4431 | if (!String.IsNullOrEmpty(fileSource) && !fileSource.EndsWith(Path.DirectorySeparatorChar.ToString(), StringComparison.Ordinal)) | 4435 | if (!String.IsNullOrEmpty(fileSource) && !fileSource.EndsWith(Path.DirectorySeparatorChar.ToString(), StringComparison.Ordinal)) |
| 4432 | { | 4436 | { |
| @@ -6324,6 +6328,9 @@ namespace WixToolset.Core | |||
| 6324 | string parentName = null; | 6328 | string parentName = null; |
| 6325 | this.ParseSFPCatalogElement(child, ref parentName); | 6329 | this.ParseSFPCatalogElement(child, ref parentName); |
| 6326 | break; | 6330 | break; |
| 6331 | case "StandardDirectory": | ||
| 6332 | this.ParseStandardDirectoryElement(child); | ||
| 6333 | break; | ||
| 6327 | case "UI": | 6334 | case "UI": |
| 6328 | this.ParseUIElement(child); | 6335 | this.ParseUIElement(child); |
| 6329 | break; | 6336 | break; |
| @@ -7559,6 +7566,71 @@ namespace WixToolset.Core | |||
| 7559 | } | 7566 | } |
| 7560 | 7567 | ||
| 7561 | /// <summary> | 7568 | /// <summary> |
| 7569 | /// Parses a standard directory element. | ||
| 7570 | /// </summary> | ||
| 7571 | /// <param name="node">Element to parse.</param> | ||
| 7572 | private void ParseStandardDirectoryElement(XElement node) | ||
| 7573 | { | ||
| 7574 | var sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node); | ||
| 7575 | string id = null; | ||
| 7576 | |||
| 7577 | foreach (var attrib in node.Attributes()) | ||
| 7578 | { | ||
| 7579 | if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || CompilerCore.WixNamespace == attrib.Name.Namespace) | ||
| 7580 | { | ||
| 7581 | switch (attrib.Name.LocalName) | ||
| 7582 | { | ||
| 7583 | case "Id": | ||
| 7584 | id = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib); | ||
| 7585 | break; | ||
| 7586 | default: | ||
| 7587 | this.Core.UnexpectedAttribute(node, attrib); | ||
| 7588 | break; | ||
| 7589 | } | ||
| 7590 | } | ||
| 7591 | else | ||
| 7592 | { | ||
| 7593 | this.Core.ParseExtensionAttribute(node, attrib); | ||
| 7594 | } | ||
| 7595 | } | ||
| 7596 | |||
| 7597 | if (String.IsNullOrEmpty(id)) | ||
| 7598 | { | ||
| 7599 | this.Core.Write(ErrorMessages.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Id")); | ||
| 7600 | } | ||
| 7601 | else if (!WindowsInstallerStandard.IsStandardDirectory(id)) | ||
| 7602 | { | ||
| 7603 | this.Core.Write(ErrorMessages.IllegalAttributeValue(sourceLineNumbers, node.Name.LocalName, "Id", id, String.Join(", \"", WindowsInstallerStandard.StandardDirectories().Select(d => d.Id.Id)))); | ||
| 7604 | } | ||
| 7605 | |||
| 7606 | foreach (var child in node.Elements()) | ||
| 7607 | { | ||
| 7608 | if (CompilerCore.WixNamespace == child.Name.Namespace) | ||
| 7609 | { | ||
| 7610 | switch (child.Name.LocalName) | ||
| 7611 | { | ||
| 7612 | case "Component": | ||
| 7613 | this.ParseComponentElement(child, ComplexReferenceParentType.Unknown, null, null, diskId: CompilerConstants.IntegerNotSet, id, srcPath: String.Empty); | ||
| 7614 | break; | ||
| 7615 | case "Directory": | ||
| 7616 | this.ParseDirectoryElement(child, id, diskId: CompilerConstants.IntegerNotSet, fileSource: String.Empty); | ||
| 7617 | break; | ||
| 7618 | case "Merge": | ||
| 7619 | this.ParseMergeElement(child, id, diskId: CompilerConstants.IntegerNotSet); | ||
| 7620 | break; | ||
| 7621 | default: | ||
| 7622 | this.Core.UnexpectedElement(node, child); | ||
| 7623 | break; | ||
| 7624 | } | ||
| 7625 | } | ||
| 7626 | else | ||
| 7627 | { | ||
| 7628 | this.Core.ParseExtensionElement(node, child); | ||
| 7629 | } | ||
| 7630 | } | ||
| 7631 | } | ||
| 7632 | |||
| 7633 | /// <summary> | ||
| 7562 | /// Parses a configuration data element. | 7634 | /// Parses a configuration data element. |
| 7563 | /// </summary> | 7635 | /// </summary> |
| 7564 | /// <param name="node">Element to parse.</param> | 7636 | /// <param name="node">Element to parse.</param> |
