[msitools] wixl: improve automatic detection of the key path
- From: Paolo Bonzini <pbonzini src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [msitools] wixl: improve automatic detection of the key path
- Date: Fri, 25 Jan 2013 08:47:23 +0000 (UTC)
commit 621893a1bec2c4d566d06724672a6136e00c6a67
Author: Paolo Bonzini <pbonzini redhat com>
Date: Fri Jan 25 09:34:24 2013 +0100
wixl: improve automatic detection of the key path
Also detect multiple elements with keyPath="yes".
tools/wixl/builder.vala | 19 +++++++++++++++++--
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 {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]