diff options
author | Marc-André Lureau <marcandre.lureau@gmail.com> | 2013-01-24 23:44:11 +0100 |
---|---|---|
committer | Marc-André Lureau <marcandre.lureau@gmail.com> | 2013-01-24 23:50:31 +0100 |
commit | 4866dcfc6b7ab1a28163fc4045b2b9d9c5e4b0aa (patch) | |
tree | 8a46e778d1833c872076ae470dd8178d648e0b5e /tools/wixl | |
parent | cdba1d64a84e41076fb999524f9e123e3bc9fa40 (diff) | |
download | msitools-4866dcfc6b7ab1a28163fc4045b2b9d9c5e4b0aa.tar.gz msitools-4866dcfc6b7ab1a28163fc4045b2b9d9c5e4b0aa.tar.xz msitools-4866dcfc6b7ab1a28163fc4045b2b9d9c5e4b0aa.zip |
wixl: add Action condition
Diffstat (limited to 'tools/wixl')
-rw-r--r-- | tools/wixl/builder.vala | 6 | ||||
-rw-r--r-- | tools/wixl/msi.vala | 12 |
2 files changed, 13 insertions, 5 deletions
diff --git a/tools/wixl/builder.vala b/tools/wixl/builder.vala index 0231c60..4b100f9 100644 --- a/tools/wixl/builder.vala +++ b/tools/wixl/builder.vala @@ -701,6 +701,12 @@ namespace Wixl { var before = table.get_action (action.Before); before.add_dep (node); } + + if (action.children.length () > 0) { + return_if_fail (action.children.length () == 1); + var text = action.children.first ().data as WixText; + node.condition = text.Text; + } } public override void visit_progid (WixProgId progid) throws GLib.Error { diff --git a/tools/wixl/msi.vala b/tools/wixl/msi.vala index 3b13860..8363364 100644 --- a/tools/wixl/msi.vala +++ b/tools/wixl/msi.vala @@ -41,11 +41,12 @@ namespace Wixl { public abstract class MsiTableSequence: MsiTable { public class MSIDefault.ActionFlags flags; - private void add (string action, int sequence) throws GLib.Error { - var rec = new Libmsi.Record (2); + private void add (string action, string? condition, int sequence) throws GLib.Error { + var rec = new Libmsi.Record (3); if (!rec.set_string (1, action) || - !rec.set_int (2, sequence)) + (condition != null && !rec.set_string (2, condition)) || + !rec.set_int (3, sequence)) throw new Wixl.Error.FAILED ("failed to add record"); records.append (rec); @@ -54,11 +55,12 @@ namespace Wixl { protected class void set_sequence_table_name (string table) { name = table; sql_create = "CREATE TABLE `%s` (`Action` CHAR(72) NOT NULL, `Condition` CHAR(255), `Sequence` INT PRIMARY KEY `Action`)".printf (table); - sql_insert = "INSERT INTO `%s` (`Action`, `Sequence`) VALUES (?, ?)".printf (table); + sql_insert = "INSERT INTO `%s` (`Action`, `Condition`, `Sequence`) VALUES (?, ?, ?)".printf (table); } public class Action { public string name; + public string? condition; public int sequence = -1; public WixAction? action; @@ -131,7 +133,7 @@ namespace Wixl { action.sequence = ++sequence; sequence = action.sequence; - add (action.name, action.sequence); + add (action.name, action.condition, action.sequence); } } |