From bac3d761d99fb7ae1012f3591baee2dbec115b28 Mon Sep 17 00:00:00 2001 From: Bob Arnson Date: Mon, 11 May 2020 17:09:47 -0400 Subject: Fix named bind paths. --- src/WixToolset.Core/Bind/FileResolver.cs | 42 ++++++++++++++++++-------- src/WixToolset.Core/CommandLine/CommandLine.cs | 2 -- 2 files changed, 29 insertions(+), 15 deletions(-) (limited to 'src/WixToolset.Core') diff --git a/src/WixToolset.Core/Bind/FileResolver.cs b/src/WixToolset.Core/Bind/FileResolver.cs index b1676fad..6bc5a676 100644 --- a/src/WixToolset.Core/Bind/FileResolver.cs +++ b/src/WixToolset.Core/Bind/FileResolver.cs @@ -115,7 +115,7 @@ namespace WixToolset.Core.Bind } else // not a rooted path so let's try applying all the different source resolution options. { - string bindName = String.Empty; + string bindName = null; var path = source; string pathWithoutSourceDir = null; @@ -138,25 +138,41 @@ namespace WixToolset.Core.Bind foreach (var bindPath in bindPaths) { - if (!String.IsNullOrEmpty(pathWithoutSourceDir)) + if (!String.IsNullOrEmpty(bindName) && !String.IsNullOrEmpty(bindPath.Name)) { - var filePath = Path.Combine(bindPath.Path, pathWithoutSourceDir); - - checkedPaths.Add(filePath); - if (CheckFileExists(filePath)) + if (String.Equals(bindName, bindPath.Name, StringComparison.OrdinalIgnoreCase) && String.IsNullOrEmpty(resolved)) { - resolved = filePath; + var filePath = Path.Combine(bindPath.Path, path); + + checkedPaths.Add(filePath); + if (CheckFileExists(filePath)) + { + resolved = filePath; + } } } - - if (String.IsNullOrEmpty(resolved)) + else { - var filePath = Path.Combine(bindPath.Path, path); + if (!String.IsNullOrEmpty(pathWithoutSourceDir)) + { + var filePath = Path.Combine(bindPath.Path, pathWithoutSourceDir); - checkedPaths.Add(filePath); - if (CheckFileExists(filePath)) + checkedPaths.Add(filePath); + if (CheckFileExists(filePath)) + { + resolved = filePath; + } + } + + if (String.IsNullOrEmpty(resolved)) { - resolved = filePath; + var filePath = Path.Combine(bindPath.Path, path); + + checkedPaths.Add(filePath); + if (CheckFileExists(filePath)) + { + resolved = filePath; + } } } } diff --git a/src/WixToolset.Core/CommandLine/CommandLine.cs b/src/WixToolset.Core/CommandLine/CommandLine.cs index 683d1f5a..79f5d5bc 100644 --- a/src/WixToolset.Core/CommandLine/CommandLine.cs +++ b/src/WixToolset.Core/CommandLine/CommandLine.cs @@ -21,8 +21,6 @@ namespace WixToolset.Core.CommandLine internal class CommandLine : ICommandLine { - private static readonly char[] BindPathSplit = { '=' }; - public CommandLine(IWixToolsetServiceProvider serviceProvider) { this.ServiceProvider = serviceProvider; -- cgit v1.2.3-55-g6feb