diff options
| author | Rob Mensching <rob@firegiant.com> | 2020-07-17 15:22:14 -0700 |
|---|---|---|
| committer | Rob Mensching <rob@firegiant.com> | 2020-07-17 15:27:13 -0700 |
| commit | 6b21265e139513c1a242d8677b154fcc0e1dc7ef (patch) | |
| tree | 7520da432e1fd2a8dc3c6de7f601bcfd632692f1 /src/WixToolset.Core | |
| parent | c37f29a156a84e27e6b38a7841e2ddcde015b071 (diff) | |
| download | wix-6b21265e139513c1a242d8677b154fcc0e1dc7ef.tar.gz wix-6b21265e139513c1a242d8677b154fcc0e1dc7ef.tar.bz2 wix-6b21265e139513c1a242d8677b154fcc0e1dc7ef.zip | |
Ensure named bindpaths are not found in unnamed bindpaths
Fixes wixtoolset/issues#6200
Diffstat (limited to 'src/WixToolset.Core')
| -rw-r--r-- | src/WixToolset.Core/Bind/FileResolver.cs | 62 |
1 files changed, 34 insertions, 28 deletions
diff --git a/src/WixToolset.Core/Bind/FileResolver.cs b/src/WixToolset.Core/Bind/FileResolver.cs index d11fcadc..ba71c6c9 100644 --- a/src/WixToolset.Core/Bind/FileResolver.cs +++ b/src/WixToolset.Core/Bind/FileResolver.cs | |||
| @@ -115,13 +115,14 @@ namespace WixToolset.Core.Bind | |||
| 115 | } | 115 | } |
| 116 | else // not a rooted path so let's try applying all the different source resolution options. | 116 | else // not a rooted path so let's try applying all the different source resolution options. |
| 117 | { | 117 | { |
| 118 | string bindName = null; | 118 | var bindName = String.Empty; |
| 119 | var path = source; | 119 | var path = source; |
| 120 | string pathWithoutSourceDir = null; | 120 | var pathWithoutSourceDir = String.Empty; |
| 121 | 121 | ||
| 122 | if (source.StartsWith(BindPathOpenString, StringComparison.Ordinal)) | 122 | if (source.StartsWith(BindPathOpenString, StringComparison.Ordinal)) |
| 123 | { | 123 | { |
| 124 | int closeParen = source.IndexOf(')', BindPathOpenString.Length); | 124 | var closeParen = source.IndexOf(')', BindPathOpenString.Length); |
| 125 | |||
| 125 | if (-1 != closeParen) | 126 | if (-1 != closeParen) |
| 126 | { | 127 | { |
| 127 | bindName = source.Substring(BindPathOpenString.Length, closeParen - BindPathOpenString.Length); | 128 | bindName = source.Substring(BindPathOpenString.Length, closeParen - BindPathOpenString.Length); |
| @@ -138,43 +139,48 @@ namespace WixToolset.Core.Bind | |||
| 138 | 139 | ||
| 139 | foreach (var bindPath in bindPaths) | 140 | foreach (var bindPath in bindPaths) |
| 140 | { | 141 | { |
| 141 | if (!String.IsNullOrEmpty(bindName) && !String.IsNullOrEmpty(bindPath.Name)) | 142 | if (String.IsNullOrEmpty(bindName)) |
| 142 | { | 143 | { |
| 143 | if (String.Equals(bindName, bindPath.Name, StringComparison.OrdinalIgnoreCase) && String.IsNullOrEmpty(resolved)) | 144 | if (String.IsNullOrEmpty(bindPath.Name)) |
| 144 | { | 145 | { |
| 145 | var filePath = Path.Combine(bindPath.Path, path); | 146 | if (!String.IsNullOrEmpty(pathWithoutSourceDir)) |
| 146 | |||
| 147 | checkedPaths.Add(filePath); | ||
| 148 | if (CheckFileExists(filePath)) | ||
| 149 | { | 147 | { |
| 150 | resolved = filePath; | 148 | var filePath = Path.Combine(bindPath.Path, pathWithoutSourceDir); |
| 149 | |||
| 150 | checkedPaths.Add(filePath); | ||
| 151 | if (CheckFileExists(filePath)) | ||
| 152 | { | ||
| 153 | resolved = filePath; | ||
| 154 | } | ||
| 151 | } | 155 | } |
| 152 | } | ||
| 153 | } | ||
| 154 | else | ||
| 155 | { | ||
| 156 | if (!String.IsNullOrEmpty(pathWithoutSourceDir)) | ||
| 157 | { | ||
| 158 | var filePath = Path.Combine(bindPath.Path, pathWithoutSourceDir); | ||
| 159 | 156 | ||
| 160 | checkedPaths.Add(filePath); | 157 | if (String.IsNullOrEmpty(resolved)) |
| 161 | if (CheckFileExists(filePath)) | ||
| 162 | { | 158 | { |
| 163 | resolved = filePath; | 159 | var filePath = Path.Combine(bindPath.Path, path); |
| 160 | |||
| 161 | checkedPaths.Add(filePath); | ||
| 162 | if (CheckFileExists(filePath)) | ||
| 163 | { | ||
| 164 | resolved = filePath; | ||
| 165 | } | ||
| 164 | } | 166 | } |
| 165 | } | 167 | } |
| 168 | } | ||
| 169 | else if (bindName.Equals(bindPath.Name, StringComparison.OrdinalIgnoreCase)) | ||
| 170 | { | ||
| 171 | var filePath = Path.Combine(bindPath.Path, path); | ||
| 166 | 172 | ||
| 167 | if (String.IsNullOrEmpty(resolved)) | 173 | checkedPaths.Add(filePath); |
| 174 | if (CheckFileExists(filePath)) | ||
| 168 | { | 175 | { |
| 169 | var filePath = Path.Combine(bindPath.Path, path); | 176 | resolved = filePath; |
| 170 | |||
| 171 | checkedPaths.Add(filePath); | ||
| 172 | if (CheckFileExists(filePath)) | ||
| 173 | { | ||
| 174 | resolved = filePath; | ||
| 175 | } | ||
| 176 | } | 177 | } |
| 177 | } | 178 | } |
| 179 | |||
| 180 | if (!String.IsNullOrEmpty(resolved)) | ||
| 181 | { | ||
| 182 | break; | ||
| 183 | } | ||
| 178 | } | 184 | } |
| 179 | } | 185 | } |
| 180 | 186 | ||
