summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorPaolo Bonzini <pbonzini@redhat.com>2013-01-25 09:34:24 +0100
committerPaolo Bonzini <pbonzini@redhat.com>2013-01-25 09:45:36 +0100
commit621893a1bec2c4d566d06724672a6136e00c6a67 (patch)
treeb8c6bcbdd6d582d572dcfd3753f493ac25e267e0 /tools
parent6722623d62a9bb0e13c427fd677a79368aeefe9a (diff)
downloadmsitools-621893a1bec2c4d566d06724672a6136e00c6a67.zip
msitools-621893a1bec2c4d566d06724672a6136e00c6a67.tar.gz
msitools-621893a1bec2c4d566d06724672a6136e00c6a67.tar.xz
wixl: improve automatic detection of the key path
Also detect multiple elements with keyPath="yes".
Diffstat (limited to 'tools')
-rw-r--r--tools/wixl/builder.vala19
1 files changed, 17 insertions, 2 deletions
diff --git a/tools/wixl/builder.vala b/tools/wixl/builder.vala
index 8b3d994..2cf9ccd 100644
--- a/tools/wixl/builder.vala
+++ b/tools/wixl/builder.vala
@@ -347,10 +347,19 @@ namespace Wixl {
buffer[12], buffer[13], buffer[14], buffer[15]);
}
+ WixKeyElement? component_default_key = null;
+ int component_children_count;
+
public override void visit_component (WixComponent comp, VisitState state) throws GLib.Error {
var attr = 0;
- if (state == VisitState.ENTER)
+ if (state == VisitState.ENTER) {
+ component_default_key = null;
+ component_children_count = 0;
return;
+ }
+
+ if (comp.key == null && component_default_key != null)
+ comp.key = component_default_key;
if (comp.key is WixRegistryValue)
attr |= ComponentAttribute.REGISTRY_KEY_PATH;
@@ -483,8 +492,14 @@ namespace Wixl {
return_if_fail (component != null);
- if (component.key == null || parse_yesno (key.KeyPath))
+ if (component_children_count++ == 0)
+ component_default_key = key;
+ if (parse_yesno (key.KeyPath)) {
+ component_default_key = null;
+ if (component.key != null)
+ throw new Wixl.Error.FAILED ("multiple elements have keyPath='yes'");
component.key = key;
+ }
}
enum RegistryValueType {