diff options
| author | Rob Mensching <rob@firegiant.com> | 2026-01-29 10:43:32 -0800 |
|---|---|---|
| committer | Rob Mensching <rob@firegiant.com> | 2026-01-29 11:19:02 -0800 |
| commit | e2842dad5ed0b530c1edc543e26e4d8b1c9448b9 (patch) | |
| tree | c107ad4e005945656986dd688f126f9d7160bca4 /src | |
| parent | 49924eb413af6f316951fcc1a7deaf28b7fd6e19 (diff) | |
| download | wix-e2842dad5ed0b530c1edc543e26e4d8b1c9448b9.tar.gz wix-e2842dad5ed0b530c1edc543e26e4d8b1c9448b9.tar.bz2 wix-e2842dad5ed0b530c1edc543e26e4d8b1c9448b9.zip | |
Use case insensitive compares for paths during harvesting
Fixes 9213
Diffstat (limited to 'src')
4 files changed, 54 insertions, 4 deletions
diff --git a/src/wix/WixToolset.Core/HarvestFilesAndPayloadsCommand.cs b/src/wix/WixToolset.Core/HarvestFilesAndPayloadsCommand.cs index b8265bc1..3746f864 100644 --- a/src/wix/WixToolset.Core/HarvestFilesAndPayloadsCommand.cs +++ b/src/wix/WixToolset.Core/HarvestFilesAndPayloadsCommand.cs | |||
| @@ -14,6 +14,7 @@ namespace WixToolset.Core | |||
| 14 | internal class HarvestFilesAndPayloadsCommand | 14 | internal class HarvestFilesAndPayloadsCommand |
| 15 | { | 15 | { |
| 16 | private const string BindPathOpenString = "!(bindpath."; | 16 | private const string BindPathOpenString = "!(bindpath."; |
| 17 | private static readonly char[] SplitSemicolons = { ';' }; | ||
| 17 | 18 | ||
| 18 | public HarvestFilesAndPayloadsCommand(IOptimizeContext context) | 19 | public HarvestFilesAndPayloadsCommand(IOptimizeContext context) |
| 19 | { | 20 | { |
| @@ -54,8 +55,8 @@ namespace WixToolset.Core | |||
| 54 | { | 55 | { |
| 55 | var unusedSectionCachedInlinedDirectoryIds = new Dictionary<string, string>(); | 56 | var unusedSectionCachedInlinedDirectoryIds = new Dictionary<string, string>(); |
| 56 | 57 | ||
| 57 | var inclusions = harvestFile.Inclusions.Split(new[] { ';' }, StringSplitOptions.RemoveEmptyEntries); | 58 | var inclusions = harvestFile.Inclusions.Split(SplitSemicolons, StringSplitOptions.RemoveEmptyEntries); |
| 58 | var exclusions = harvestFile.Exclusions.Split(new[] { ';' }, StringSplitOptions.RemoveEmptyEntries); | 59 | var exclusions = harvestFile.Exclusions.Split(SplitSemicolons, StringSplitOptions.RemoveEmptyEntries); |
| 59 | 60 | ||
| 60 | var comparer = new WildcardFileComparer(); | 61 | var comparer = new WildcardFileComparer(); |
| 61 | 62 | ||
| @@ -312,12 +313,12 @@ namespace WixToolset.Core | |||
| 312 | { | 313 | { |
| 313 | public bool Equals(WildcardFile x, WildcardFile y) | 314 | public bool Equals(WildcardFile x, WildcardFile y) |
| 314 | { | 315 | { |
| 315 | return x?.Path == y?.Path; | 316 | return StringComparer.OrdinalIgnoreCase.Equals(x?.Path, y?.Path); |
| 316 | } | 317 | } |
| 317 | 318 | ||
| 318 | public int GetHashCode(WildcardFile obj) | 319 | public int GetHashCode(WildcardFile obj) |
| 319 | { | 320 | { |
| 320 | return obj?.Path?.GetHashCode() ?? 0; | 321 | return obj?.Path is null ? 0 : StringComparer.OrdinalIgnoreCase.GetHashCode(obj.Path); |
| 321 | } | 322 | } |
| 322 | } | 323 | } |
| 323 | } | 324 | } |
diff --git a/src/wix/test/WixToolsetTest.CoreIntegration/HarvestFilesFixture.cs b/src/wix/test/WixToolsetTest.CoreIntegration/HarvestFilesFixture.cs index 4d7253b8..9efae115 100644 --- a/src/wix/test/WixToolsetTest.CoreIntegration/HarvestFilesFixture.cs +++ b/src/wix/test/WixToolsetTest.CoreIntegration/HarvestFilesFixture.cs | |||
| @@ -143,6 +143,33 @@ namespace WixToolsetTest.CoreIntegration | |||
| 143 | } | 143 | } |
| 144 | 144 | ||
| 145 | [Fact] | 145 | [Fact] |
| 146 | public void CanHarvestFilesWithCaseInsensitiveExcludeSubdirectory() | ||
| 147 | { | ||
| 148 | var expected = new[] | ||
| 149 | { | ||
| 150 | @"flsYgiwrDUkZnBEK6iUMkxxaJlD8yQ=PFiles\MsiPackage\test1.txt", | ||
| 151 | @"flslrDWblm4pE.4i4jR58_XyYMmR8I=PFiles\MsiPackage\files1_sub1\files1_sub2\test120.txt", | ||
| 152 | @"flsj.cb0sFWqIPHPFSKJSEEaPDuAQ4=PFiles\MsiPackage\test2.txt", | ||
| 153 | }; | ||
| 154 | |||
| 155 | Build("CaseInsensitiveExcludeSubdir.wxs", (msiPath, _) => AssertFileIdsAndTargetPaths(msiPath, expected)); | ||
| 156 | } | ||
| 157 | |||
| 158 | [Fact] | ||
| 159 | public void CanHarvestFilesWithCaseInsensitiveIncludeExclude() | ||
| 160 | { | ||
| 161 | var expected = new[] | ||
| 162 | { | ||
| 163 | @"flsaFu0CvigRX6Psea0ic6ZWevzLmI=PFiles\MsiPackage\test3.txt", | ||
| 164 | @"flsJBy_HKCNejalUyud4HisGqhd72E=PFiles\MsiPackage\test4.txt", | ||
| 165 | @"fls05.yw49T0FVAq3Wvq2ihNp3KWfI=PFiles\MsiPackage\files2_sub2\test20.txt", | ||
| 166 | @"flsf0falU_gCTJjtbSCNiFpJQ1d8EM=PFiles\MsiPackage\files2_sub2\test21.txt", | ||
| 167 | }; | ||
| 168 | |||
| 169 | Build("CaseInsensitiveIncludeExclude.wxs", (msiPath, _) => AssertFileIdsAndTargetPaths(msiPath, expected)); | ||
| 170 | } | ||
| 171 | |||
| 172 | [Fact] | ||
| 146 | public void CanHarvestFilesInDirectoryRef() | 173 | public void CanHarvestFilesInDirectoryRef() |
| 147 | { | 174 | { |
| 148 | var expected = new[] | 175 | var expected = new[] |
diff --git a/src/wix/test/WixToolsetTest.CoreIntegration/TestData/HarvestFiles/CaseInsensitiveExcludeSubdir.wxs b/src/wix/test/WixToolsetTest.CoreIntegration/TestData/HarvestFiles/CaseInsensitiveExcludeSubdir.wxs new file mode 100644 index 00000000..7bb47429 --- /dev/null +++ b/src/wix/test/WixToolsetTest.CoreIntegration/TestData/HarvestFiles/CaseInsensitiveExcludeSubdir.wxs | |||
| @@ -0,0 +1,11 @@ | |||
| 1 | <Wix xmlns="http://wixtoolset.org/schemas/v4/wxs"> | ||
| 2 | <Package Id="WixTest.MsiPackage" Name="MsiPackage" Version="1.0.0.0" Manufacturer="Example Corporation"> | ||
| 3 | <StandardDirectory Id="ProgramFilesFolder"> | ||
| 4 | <Directory Id="INSTALLFOLDER" Name="MsiPackage" FileSource="$(sys.SOURCEFILEDIR)"> | ||
| 5 | <Files Include="files1\**"> | ||
| 6 | <Exclude Files="FILES1\FILES1_SUB1\*" /> | ||
| 7 | </Files> | ||
| 8 | </Directory> | ||
| 9 | </StandardDirectory> | ||
| 10 | </Package> | ||
| 11 | </Wix> | ||
diff --git a/src/wix/test/WixToolsetTest.CoreIntegration/TestData/HarvestFiles/CaseInsensitiveIncludeExclude.wxs b/src/wix/test/WixToolsetTest.CoreIntegration/TestData/HarvestFiles/CaseInsensitiveIncludeExclude.wxs new file mode 100644 index 00000000..6a703825 --- /dev/null +++ b/src/wix/test/WixToolsetTest.CoreIntegration/TestData/HarvestFiles/CaseInsensitiveIncludeExclude.wxs | |||
| @@ -0,0 +1,11 @@ | |||
| 1 | <Wix xmlns="http://wixtoolset.org/schemas/v4/wxs"> | ||
| 2 | <Package Id="WixTest.MsiPackage" Name="MsiPackage" Version="1.0.0.0" Manufacturer="Example Corporation"> | ||
| 3 | <StandardDirectory Id="ProgramFilesFolder"> | ||
| 4 | <Directory Id="INSTALLFOLDER" Name="MsiPackage" FileSource="$(sys.SOURCEFILEDIR)"> | ||
| 5 | <Files Include="FILES2\**\*.TXT"> | ||
| 6 | <Exclude Files="files2\NOTATEST.txt" /> | ||
| 7 | </Files> | ||
| 8 | </Directory> | ||
| 9 | </StandardDirectory> | ||
| 10 | </Package> | ||
| 11 | </Wix> | ||
