diff options
author | Marc-André Lureau <marcandre.lureau@gmail.com> | 2013-01-09 00:41:31 +0100 |
---|---|---|
committer | Marc-André Lureau <marcandre.lureau@gmail.com> | 2013-01-09 00:41:31 +0100 |
commit | 7abd051eb25f7eebcbcab7bc2b2511d1a1bf4852 (patch) | |
tree | 2537058b616d2a180bf30158e9db2dcd1972b6a7 | |
parent | 48343917c67aea722459836beb987ae2bfab0078 (diff) | |
download | msitools-7abd051eb25f7eebcbcab7bc2b2511d1a1bf4852.tar.gz msitools-7abd051eb25f7eebcbcab7bc2b2511d1a1bf4852.tar.xz msitools-7abd051eb25f7eebcbcab7bc2b2511d1a1bf4852.zip |
Populate LaunchCondition table
-rw-r--r-- | src/builder.vala | 4 | ||||
-rw-r--r-- | src/msi.vala | 21 |
2 files changed, 25 insertions, 0 deletions
diff --git a/src/builder.vala b/src/builder.vala index 3ff2af4..f36635a 100644 --- a/src/builder.vala +++ b/src/builder.vala @@ -508,6 +508,10 @@ namespace Wixl { } public override void visit_condition (WixCondition condition) throws GLib.Error { + return_if_fail (condition.children.length () == 1); + var text = condition.children.first ().data as WixText; + + db.table_launch_condition.add (text.Text, condition.Message); } [Flags] diff --git a/src/msi.vala b/src/msi.vala index eab8dcd..336c169 100644 --- a/src/msi.vala +++ b/src/msi.vala @@ -209,6 +209,24 @@ namespace Wixl { } } + class MsiTableLaunchCondition: MsiTable { + static construct { + name = "LaunchCondition"; + sql_create = "CREATE TABLE `LaunchCondition` (`Condition` CHAR(255) NOT NULL, `Description` CHAR(255) NOT NULL LOCALIZABLE PRIMARY KEY `Condition`)"; + sql_insert = "INSERT INTO `LaunchCondition` (`Condition`, `Description`) VALUES (?, ?)"; + } + + public void add (string condition, string description) throws GLib.Error { + var rec = new Libmsi.Record (2); + + if (!rec.set_string (1, condition) || + !rec.set_string (2, description)) + throw new Wixl.Error.FAILED ("failed to add record"); + + records.append (rec); + } + } + class MsiTableProperty: MsiTable { static construct { name = "Property"; @@ -481,6 +499,7 @@ namespace Wixl { public MsiTableStreams table_streams; public MsiTableShortcut table_shortcut; public MsiTableUpgrade table_upgrade; + public MsiTableLaunchCondition table_launch_condition; HashTable<string, MsiTable> tables; @@ -523,6 +542,7 @@ namespace Wixl { table_streams = new MsiTableStreams (); table_shortcut = new MsiTableShortcut (); table_upgrade = new MsiTableUpgrade (); + table_launch_condition = new MsiTableLaunchCondition (); foreach (var t in new MsiTable[] { table_admin_execute_sequence, @@ -543,6 +563,7 @@ namespace Wixl { table_streams, table_shortcut, table_upgrade, + table_launch_condition, new MsiTableError (), new MsiTableValidation () }) { |