Fix keypath bug and overload resolution oddity.
- Ensure a component with directory keypath is accurately reflected in `ComponentTuple.KeyPathType`. - To ensure callers don't have to reference wix.dll, have separate static methods for converting a file or a live WiX v3 `Output` object.
Bob Arnson committed
Jun 25, 2019 at 18:52 UTC
c950d39509e67705a660227df5a03bb77ed7b578
2 files changed
+9
-9
src/WixToolset.Converters.Tupleizer/ConvertTuples.cs
renamed
+7
-6
@@ -10,15 +10,15 @@ namespace WixToolset.Converters.Tupleizer
10
using WixToolset.Data.WindowsInstaller;
11
using Wix3 = Microsoft.Tools.WindowsInstallerXml;
12
13
- public class ConvertTuplesCommand
13
+ public static class ConvertTuples
14
{
15
- public Intermediate Execute(string path)
15
+ public static Intermediate ConvertFile(string path)
16
{
17
var output = Wix3.Output.Load(path, suppressVersionCheck: true, suppressSchema: true);
18
- return this.Execute(output);
18
+ return ConvertOutput(output);
19
}
20
21
- public Intermediate Execute(Wix3.Output output)
21
+ public static Intermediate ConvertOutput(Wix3.Output output)
22
{
23
var section = new IntermediateSection(String.Empty, OutputType3ToSectionType4(output.Type), output.Codepage);
24
@@ -118,7 +118,8 @@ namespace WixToolset.Converters.Tupleizer
118
location = ComponentLocation.Either;
119
}
120
121
- var keyPathType = ComponentKeyPathType.File;
121
+ var keyPath = FieldAsString(row, 5);
122
+ var keyPathType = String.IsNullOrEmpty(keyPath) ? ComponentKeyPathType.Directory : ComponentKeyPathType.File;
123
if ((attributes & WindowsInstallerConstants.MsidbComponentAttributesRegistryKeyPath) == WindowsInstallerConstants.MsidbComponentAttributesRegistryKeyPath)
124
{
125
keyPathType = ComponentKeyPathType.Registry;
@@ -133,7 +134,7 @@ namespace WixToolset.Converters.Tupleizer
134
ComponentId = FieldAsString(row, 1),
135
DirectoryRef = FieldAsString(row, 2),
136
Condition = FieldAsString(row, 4),
136
- KeyPath = FieldAsString(row, 5),
137
+ KeyPath = keyPath,
138
Location = location,
139
DisableRegistryReflection = (attributes & WindowsInstallerConstants.MsidbComponentAttributesDisableRegistryReflection) == WindowsInstallerConstants.MsidbComponentAttributesDisableRegistryReflection,
140
NeverOverwrite = (attributes & WindowsInstallerConstants.MsidbComponentAttributesNeverOverwrite) == WindowsInstallerConstants.MsidbComponentAttributesNeverOverwrite,
src/test/WixToolsetTest.Converters.Tupleizer/ConvertTuplesFixture.cs
+2
-3
@@ -27,10 +27,8 @@ namespace WixToolsetTest.Converters.Tupleizer
27
var intermediateFolder = fs.GetFolder();
28
29
var path = Path.Combine(dataFolder, "test.wixout");
30
- var output = Wix3.Output.Load(path, suppressVersionCheck: true, suppressSchema: true);
30
32
- var command = new ConvertTuplesCommand();
33
- var intermediate = command.Execute(output);
31
+ var intermediate = ConvertTuples.ConvertFile(path);
32
33
Assert.NotNull(intermediate);
34
Assert.Single(intermediate.Sections);
@@ -43,6 +41,7 @@ namespace WixToolsetTest.Converters.Tupleizer
41
42
intermediate = Intermediate.Load(wixiplFile);
43
44
+ var output = Wix3.Output.Load(path, suppressVersionCheck: true, suppressSchema: true);
45
var wixMediaByDiskId = IndexWixMediaTableByDiskId(output);
46
47
// Dump to text for easy diffing, with some massaging to keep v3 and v4 diffable.