diff options
author | Paolo Bonzini <pbonzini@redhat.com> | 2013-01-25 09:33:25 +0100 |
---|---|---|
committer | Paolo Bonzini <pbonzini@redhat.com> | 2013-01-25 09:45:36 +0100 |
commit | 6722623d62a9bb0e13c427fd677a79368aeefe9a (patch) | |
tree | 109c9259be1ec48372ce99b420cddeaab8efcec6 /tools/wixl | |
parent | 42e457fb52a35893e4a63cce42774dbf6d2fb3d6 (diff) | |
download | msitools-6722623d62a9bb0e13c427fd677a79368aeefe9a.tar.gz msitools-6722623d62a9bb0e13c427fd677a79368aeefe9a.tar.xz msitools-6722623d62a9bb0e13c427fd677a79368aeefe9a.zip |
wixl: reorganize full_path, add the key element to the stable UUID
Call the resolver from the override of WixElementRef.
Override in WixComponent, making it look at the key component.
Add a new method to fetch the name part from a <File> or
<RegistryValue> element.
Diffstat (limited to 'tools/wixl')
-rw-r--r-- | tools/wixl/wix.vala | 38 |
1 files changed, 28 insertions, 10 deletions
diff --git a/tools/wixl/wix.vala b/tools/wixl/wix.vala index a7cf3c9..a041996 100644 --- a/tools/wixl/wix.vala +++ b/tools/wixl/wix.vala @@ -149,16 +149,9 @@ namespace Wixl { return array; } - public string full_path (WixResolver r) throws GLib.Error { - WixDirectory dir = null; - - if (parent != null && parent is WixDirectory) - dir = this.parent as WixDirectory; - else if (parent != null && parent is WixDirectoryRef) - dir = r.resolve<WixDirectory> (this.parent); - - if (dir != null) - return dir.full_path (r) + "/" + this.Id; + public virtual string full_path (WixResolver r) throws GLib.Error { + if (parent != null && (parent is WixDirectory || parent is WixDirectoryRef)) + return parent.full_path (r) + "/" + this.Id; else return this.Id; } @@ -398,6 +391,10 @@ namespace Wixl { public abstract class WixKeyElement: WixElement { public string KeyPath { get; set; } + + public virtual string path_name () throws GLib.Error { + throw new Wixl.Error.FAILED("this key path does not support generating a component GUID"); + } } public class WixFile: WixKeyElement { @@ -413,6 +410,10 @@ namespace Wixl { public File file; + public override string path_name () throws GLib.Error { + return Name; + } + public override void accept (WixNodeVisitor visitor) throws GLib.Error { base.accept (visitor); visitor.visit_file (this); @@ -430,6 +431,10 @@ namespace Wixl { public string Value { get; set; } public string Name { get; set; } + public override string path_name () throws GLib.Error { + return Root + "/" + Key; + } + public override void accept (WixNodeVisitor visitor) throws GLib.Error { visitor.visit_registry_value (this); } @@ -999,6 +1004,14 @@ namespace Wixl { base.accept (visitor); visitor.visit_component (this, VisitState.LEAVE); } + + public override string full_path (WixResolver r) throws GLib.Error { + if (key == null) + throw new Wixl.Error.FAILED("a child is needed to generate a component GUID"); + + return parent.full_path (r) + "/" + key.path_name (); + } + } public class WixDirectory: WixElement { @@ -1027,6 +1040,11 @@ namespace Wixl { // // FIXME vala: class init/construct fails, construct fails... // ref_type = typeof (G); // } + + public override string full_path (WixResolver r) throws GLib.Error { + return (r.resolve<G> (this) as WixElement).full_path (r); + } + } public class WixDirectoryRef: WixElementRef<WixDirectory> { |