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 ++++++++++++++++++++++---------- 1 file changed, 29 insertions(+), 13 deletions(-) (limited to 'src/WixToolset.Core/Bind/FileResolver.cs') 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; + } } } } -- cgit v1.2.3-55-g6feb