[msitools] wixl: Add CreateFolder



commit fb78165f1e084f48abd93e003a6045fa11a9bf69
Author: Marc-André Lureau <marcandre lureau gmail com>
Date:   Thu Jul 11 18:19:55 2013 +0200

    wixl: Add CreateFolder

 tools/wixl/builder.vala |    8 ++++++++
 tools/wixl/msi.vala     |   20 ++++++++++++++++++++
 tools/wixl/wix.vala     |    1 +
 3 files changed, 29 insertions(+), 0 deletions(-)
---
diff --git a/tools/wixl/builder.vala b/tools/wixl/builder.vala
index 65c97bd..368b6c2 100644
--- a/tools/wixl/builder.vala
+++ b/tools/wixl/builder.vala
@@ -171,6 +171,11 @@ namespace Wixl {
             }
             if (db.table_service_install.records.length () > 0)
                 add (MSIDefault.Action.InstallServices);
+            if (db.table_create_folder.records.length () > 0) {
+                add (MSIDefault.Action.RemoveFolders);
+                add (MSIDefault.Action.CreateFolders);
+            }
+
             table.add_sorted_actions ();
 
             // InstallUISequence
@@ -828,6 +833,9 @@ namespace Wixl {
         }
 
         public override void visit_create_folder (WixCreateFolder folder) throws GLib.Error {
+            var component = folder.parent as WixComponent;
+            var dir = get_directory (component);
+            db.table_create_folder.add (dir.Id, component.Id);
         }
 
         public override void visit_fragment (WixFragment fragment) throws GLib.Error {
diff --git a/tools/wixl/msi.vala b/tools/wixl/msi.vala
index cf7d46f..e2b5490 100644
--- a/tools/wixl/msi.vala
+++ b/tools/wixl/msi.vala
@@ -489,6 +489,23 @@ namespace Wixl {
         }
     }
 
+    class MsiTableCreateFolder: MsiTable {
+        static construct {
+            name = "CreateFolder";
+            sql_create = "CREATE TABLE `CreateFolder` (`Directory_` CHAR(72) NOT NULL, `Component_` CHAR(72) 
NOT NULL PRIMARY KEY `Directory_`, `Component_`)";
+            sql_insert = "INSERT INTO `CreateFolder` (`Directory_`, `Component_`) VALUES (?, ?)";
+        }
+
+        public void add (string Directory, string Component) throws GLib.Error {
+            var rec = new Libmsi.Record (2);
+            if (!rec.set_string (1, Directory) ||
+                !rec.set_string (2, Component))
+                throw new Wixl.Error.FAILED ("failed to add record");
+
+            records.append (rec);
+        }
+    }
+
     class MsiTableRemoveFile: MsiTable {
         static construct {
             name = "RemoveFile";
@@ -754,6 +771,7 @@ namespace Wixl {
         public MsiTableAppSearch table_app_search;
         public MsiTableCustomAction table_custom_action;
         public MsiTableRegLocator table_reg_locator;
+        public MsiTableCreateFolder table_create_folder;
 
         public HashTable<string, MsiTable> tables;
 
@@ -818,6 +836,7 @@ namespace Wixl {
             table_app_search = new MsiTableAppSearch ();
             table_custom_action = new MsiTableCustomAction ();
             table_reg_locator = new MsiTableRegLocator ();
+            table_create_folder = new MsiTableCreateFolder ();
 
             foreach (var t in new MsiTable[] {
                     table_admin_execute_sequence,
@@ -845,6 +864,7 @@ namespace Wixl {
                     table_app_search,
                     table_custom_action,
                     table_reg_locator,
+                    table_create_folder,
                     new MsiTableError (),
                     new MsiTableValidation ()
                 }) {
diff --git a/tools/wixl/wix.vala b/tools/wixl/wix.vala
index 93ff935..3120be7 100644
--- a/tools/wixl/wix.vala
+++ b/tools/wixl/wix.vala
@@ -1025,6 +1025,7 @@ namespace Wixl {
             name = "Component";
 
             add_child_types (child_types, {
+                typeof (WixCreateFolder),
                 typeof (WixRemoveFolder),
                 typeof (WixRegistryValue),
                 typeof (WixFile),


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]