From 8e08acb229ade411b7418df63b14198220aaaaa7 Mon Sep 17 00:00:00 2001 From: Sean Hall Date: Wed, 16 Dec 2020 18:01:23 -0600 Subject: Add GetCanonicalRelativePath. --- src/WixToolset.Extensibility/Services/IBackendHelper.cs | 11 +++++++++++ src/WixToolset.Extensibility/Services/IParseHelper.cs | 11 +++++++++++ 2 files changed, 22 insertions(+) (limited to 'src') diff --git a/src/WixToolset.Extensibility/Services/IBackendHelper.cs b/src/WixToolset.Extensibility/Services/IBackendHelper.cs index 26023674..bfec5256 100644 --- a/src/WixToolset.Extensibility/Services/IBackendHelper.cs +++ b/src/WixToolset.Extensibility/Services/IBackendHelper.cs @@ -35,6 +35,17 @@ namespace WixToolset.Extensibility.Services /// Resolved directory. IResolvedDirectory CreateResolvedDirectory(string directoryParent, string name); + /// + /// Validates path is relative and canonicalizes it. + /// For example, "a\..\c\.\d.exe" => "c\d.exe". + /// + /// + /// + /// + /// + /// The original value if not relative, otherwise the canonicalized relative path. + string GetCanonicalRelativePath(SourceLineNumber sourceLineNumbers, string elementName, string attributeName, string relativePath); + /// /// Creates a tracked file. /// diff --git a/src/WixToolset.Extensibility/Services/IParseHelper.cs b/src/WixToolset.Extensibility/Services/IParseHelper.cs index a7c5eb1b..08bcd911 100644 --- a/src/WixToolset.Extensibility/Services/IParseHelper.cs +++ b/src/WixToolset.Extensibility/Services/IParseHelper.cs @@ -340,6 +340,17 @@ namespace WixToolset.Extensibility.Services /// The attribute's YesNoType value. YesNoDefaultType GetAttributeYesNoDefaultValue(SourceLineNumber sourceLineNumbers, XAttribute attribute); + /// + /// Validates path is relative and canonicalizes it. + /// For example, "a\..\c\.\d.exe" => "c\d.exe". + /// + /// + /// + /// + /// + /// The original value if not relative, otherwise the canonicalized relative path. + string GetCanonicalRelativePath(SourceLineNumber sourceLineNumbers, string elementName, string attributeName, string relativePath); + /// /// Gets a source line number for an element. /// -- cgit v1.2.3-55-g6feb