From 4f1209d8e795ddeb4c639c96081bcfebbfa8e1e2 Mon Sep 17 00:00:00 2001 From: Bob Arnson Date: Sat, 17 Feb 2024 18:48:59 -0500 Subject: [PATCH] Support loc strings for Directory/@ShortName. Fixes https://github.com/wixtoolset/issues/issues/7935. --- src/wix/WixToolset.Core/CompilerCore.cs | 4 +++- .../test/WixToolsetTest.CoreIntegration/MsiQueryFixture.cs | 2 ++ .../TestData/DefaultDir/DefaultDir.wxs | 1 + .../TestData/DefaultDir/Package.en-us.wxl | 4 ++++ 4 files changed, 10 insertions(+), 1 deletion(-) create mode 100644 src/wix/test/WixToolsetTest.CoreIntegration/TestData/DefaultDir/Package.en-us.wxl diff --git a/src/wix/WixToolset.Core/CompilerCore.cs b/src/wix/WixToolset.Core/CompilerCore.cs index b01f8670b..8d1c7e0ac 100644 --- a/src/wix/WixToolset.Core/CompilerCore.cs +++ b/src/wix/WixToolset.Core/CompilerCore.cs @@ -703,7 +703,9 @@ public string GetAttributeShortFilename(SourceLineNumber sourceLineNumbers, XAtt if (0 < value.Length) { - if (!this.parseHelper.IsValidShortFilename(value, allowWildcards) && !Common.ContainsValidBinderVariable(value)) + if (!this.parseHelper.IsValidShortFilename(value, allowWildcards) + && !Common.ContainsValidBinderVariable(value) + && !this.IsValidLocIdentifier(value)) { this.Write(ErrorMessages.IllegalShortFilename(sourceLineNumbers, attribute.Parent.Name.LocalName, attribute.Name.LocalName, value)); } diff --git a/src/wix/test/WixToolsetTest.CoreIntegration/MsiQueryFixture.cs b/src/wix/test/WixToolsetTest.CoreIntegration/MsiQueryFixture.cs index 945e2133e..b1d2955bd 100644 --- a/src/wix/test/WixToolsetTest.CoreIntegration/MsiQueryFixture.cs +++ b/src/wix/test/WixToolsetTest.CoreIntegration/MsiQueryFixture.cs @@ -233,6 +233,7 @@ public void PopulatesDirectoryTableWithValidDefaultDir() "-sw1031", // this is expected for this test Path.Combine(folder, "DefaultDir", "DefaultDir.wxs"), Path.Combine(folder, "ProductWithComponentGroupRef", "Product.wxs"), + "-loc", Path.Combine(folder, "DefaultDir", "Package.en-us.wxl"), "-bindpath", Path.Combine(folder, "SingleFile", "data"), "-intermediateFolder", intermediateFolder, "-o", msiPath @@ -252,6 +253,7 @@ public void PopulatesDirectoryTableWithValidDefaultDir() "Directory:GitFolder\tINSTALLFOLDER\t69sdfw2d|.git", "Directory:INSTALLFOLDER\tProgramFiles6432Folder\t1egc1laj|MsiPackage", "Directory:NAMEANDSHORTNAME\tINSTALLFOLDER\tSHORTNAM|NameAndShortName", + "Directory:NAMEANDSHORTNAMEVIALOCSTRING\tINSTALLFOLDER\tSHRTNAME|ShortName", "Directory:NAMEANDSHORTSOURCENAME\tINSTALLFOLDER\tNAMEASSN|NameAndShortSourceName", "Directory:NAMEWITHSHORTVALUE\tINSTALLFOLDER\tSHORTVAL", "Directory:ProgramFiles6432Folder\tProgramFilesFolder\t.", diff --git a/src/wix/test/WixToolsetTest.CoreIntegration/TestData/DefaultDir/DefaultDir.wxs b/src/wix/test/WixToolsetTest.CoreIntegration/TestData/DefaultDir/DefaultDir.wxs index 298b6c54a..06ccbea45 100644 --- a/src/wix/test/WixToolsetTest.CoreIntegration/TestData/DefaultDir/DefaultDir.wxs +++ b/src/wix/test/WixToolsetTest.CoreIntegration/TestData/DefaultDir/DefaultDir.wxs @@ -10,6 +10,7 @@ + diff --git a/src/wix/test/WixToolsetTest.CoreIntegration/TestData/DefaultDir/Package.en-us.wxl b/src/wix/test/WixToolsetTest.CoreIntegration/TestData/DefaultDir/Package.en-us.wxl new file mode 100644 index 000000000..e5e1db009 --- /dev/null +++ b/src/wix/test/WixToolsetTest.CoreIntegration/TestData/DefaultDir/Package.en-us.wxl @@ -0,0 +1,4 @@ + + + +