aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBob Arnson <bob@joyofsetup.com>2019-06-25 18:52:09 -0400
committerBob Arnson <bob@firegiant.com>2019-06-25 20:13:41 -0400
commitc950d39509e67705a660227df5a03bb77ed7b578 (patch)
treedc6e0db667de9300fafaa3618b0237d6031abb42 /src
parenta056927970ba5453462143e61a62c2bc19d61c91 (diff)
downloadwix-c950d39509e67705a660227df5a03bb77ed7b578.tar.gz
wix-c950d39509e67705a660227df5a03bb77ed7b578.tar.bz2
wix-c950d39509e67705a660227df5a03bb77ed7b578.zip
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.
Diffstat (limited to 'src')
-rw-r--r--src/WixToolset.Converters.Tupleizer/ConvertTuples.cs (renamed from src/WixToolset.Converters.Tupleizer/ConvertTuplesCommand.cs)13
-rw-r--r--src/test/WixToolsetTest.Converters.Tupleizer/ConvertTuplesFixture.cs5
2 files changed, 9 insertions, 9 deletions
diff --git a/src/WixToolset.Converters.Tupleizer/ConvertTuplesCommand.cs b/src/WixToolset.Converters.Tupleizer/ConvertTuples.cs
index b878f656..88fe0575 100644
--- a/src/WixToolset.Converters.Tupleizer/ConvertTuplesCommand.cs
+++ b/src/WixToolset.Converters.Tupleizer/ConvertTuples.cs
@@ -10,15 +10,15 @@ namespace WixToolset.Converters.Tupleizer
10 using WixToolset.Data.WindowsInstaller; 10 using WixToolset.Data.WindowsInstaller;
11 using Wix3 = Microsoft.Tools.WindowsInstallerXml; 11 using Wix3 = Microsoft.Tools.WindowsInstallerXml;
12 12
13 public class ConvertTuplesCommand 13 public static class ConvertTuples
14 { 14 {
15 public Intermediate Execute(string path) 15 public static Intermediate ConvertFile(string path)
16 { 16 {
17 var output = Wix3.Output.Load(path, suppressVersionCheck: true, suppressSchema: true); 17 var output = Wix3.Output.Load(path, suppressVersionCheck: true, suppressSchema: true);
18 return this.Execute(output); 18 return ConvertOutput(output);
19 } 19 }
20 20
21 public Intermediate Execute(Wix3.Output output) 21 public static Intermediate ConvertOutput(Wix3.Output output)
22 { 22 {
23 var section = new IntermediateSection(String.Empty, OutputType3ToSectionType4(output.Type), output.Codepage); 23 var section = new IntermediateSection(String.Empty, OutputType3ToSectionType4(output.Type), output.Codepage);
24 24
@@ -118,7 +118,8 @@ namespace WixToolset.Converters.Tupleizer
118 location = ComponentLocation.Either; 118 location = ComponentLocation.Either;
119 } 119 }
120 120
121 var keyPathType = ComponentKeyPathType.File; 121 var keyPath = FieldAsString(row, 5);
122 var keyPathType = String.IsNullOrEmpty(keyPath) ? ComponentKeyPathType.Directory : ComponentKeyPathType.File;
122 if ((attributes & WindowsInstallerConstants.MsidbComponentAttributesRegistryKeyPath) == WindowsInstallerConstants.MsidbComponentAttributesRegistryKeyPath) 123 if ((attributes & WindowsInstallerConstants.MsidbComponentAttributesRegistryKeyPath) == WindowsInstallerConstants.MsidbComponentAttributesRegistryKeyPath)
123 { 124 {
124 keyPathType = ComponentKeyPathType.Registry; 125 keyPathType = ComponentKeyPathType.Registry;
@@ -133,7 +134,7 @@ namespace WixToolset.Converters.Tupleizer
133 ComponentId = FieldAsString(row, 1), 134 ComponentId = FieldAsString(row, 1),
134 DirectoryRef = FieldAsString(row, 2), 135 DirectoryRef = FieldAsString(row, 2),
135 Condition = FieldAsString(row, 4), 136 Condition = FieldAsString(row, 4),
136 KeyPath = FieldAsString(row, 5), 137 KeyPath = keyPath,
137 Location = location, 138 Location = location,
138 DisableRegistryReflection = (attributes & WindowsInstallerConstants.MsidbComponentAttributesDisableRegistryReflection) == WindowsInstallerConstants.MsidbComponentAttributesDisableRegistryReflection, 139 DisableRegistryReflection = (attributes & WindowsInstallerConstants.MsidbComponentAttributesDisableRegistryReflection) == WindowsInstallerConstants.MsidbComponentAttributesDisableRegistryReflection,
139 NeverOverwrite = (attributes & WindowsInstallerConstants.MsidbComponentAttributesNeverOverwrite) == WindowsInstallerConstants.MsidbComponentAttributesNeverOverwrite, 140 NeverOverwrite = (attributes & WindowsInstallerConstants.MsidbComponentAttributesNeverOverwrite) == WindowsInstallerConstants.MsidbComponentAttributesNeverOverwrite,
diff --git a/src/test/WixToolsetTest.Converters.Tupleizer/ConvertTuplesFixture.cs b/src/test/WixToolsetTest.Converters.Tupleizer/ConvertTuplesFixture.cs
index a180e20d..5df577f6 100644
--- a/src/test/WixToolsetTest.Converters.Tupleizer/ConvertTuplesFixture.cs
+++ b/src/test/WixToolsetTest.Converters.Tupleizer/ConvertTuplesFixture.cs
@@ -27,10 +27,8 @@ namespace WixToolsetTest.Converters.Tupleizer
27 var intermediateFolder = fs.GetFolder(); 27 var intermediateFolder = fs.GetFolder();
28 28
29 var path = Path.Combine(dataFolder, "test.wixout"); 29 var path = Path.Combine(dataFolder, "test.wixout");
30 var output = Wix3.Output.Load(path, suppressVersionCheck: true, suppressSchema: true);
31 30
32 var command = new ConvertTuplesCommand(); 31 var intermediate = ConvertTuples.ConvertFile(path);
33 var intermediate = command.Execute(output);
34 32
35 Assert.NotNull(intermediate); 33 Assert.NotNull(intermediate);
36 Assert.Single(intermediate.Sections); 34 Assert.Single(intermediate.Sections);
@@ -43,6 +41,7 @@ namespace WixToolsetTest.Converters.Tupleizer
43 41
44 intermediate = Intermediate.Load(wixiplFile); 42 intermediate = Intermediate.Load(wixiplFile);
45 43
44 var output = Wix3.Output.Load(path, suppressVersionCheck: true, suppressSchema: true);
46 var wixMediaByDiskId = IndexWixMediaTableByDiskId(output); 45 var wixMediaByDiskId = IndexWixMediaTableByDiskId(output);
47 46
48 // Dump to text for easy diffing, with some massaging to keep v3 and v4 diffable. 47 // Dump to text for easy diffing, with some massaging to keep v3 and v4 diffable.