[msitools: 1/2] tools/wixl: Support use of FileKey in CustomAction



commit b0c3c4cd13ef4c40b7668ef7610b2c55892ac914
Author: Liam 'Auzzie' Haworth <liam haworth id au>
Date:   Fri Sep 13 00:08:42 2019 +1000

    tools/wixl: Support use of FileKey in CustomAction
    
    Working on project that builds a 32bit installer intended to be installed
    on both 32bit and 64bit systems, to support this the CustomActions in the
    installer need to be aware of the installed location.
    
    MSI's support this through the use of `FileKey` which informs the MSI to
    use the file installed on the system referenced by `FileKey`.
    
    This pull request updates the fields of `WixCustomAction` to include the
    field `FileKey` and updated the logic of `visit_custom_action` (in `builder.vala`)
    to check for the validity of the field.
    
    If the field has been set the custom action will be of the type `EXE_FILE`,
    otherwise the existing behaviour of using `EXE_PROPERTY` remains.

 tools/wixl/builder.vala | 9 ++++++++-
 tools/wixl/wix.vala     | 1 +
 2 files changed, 9 insertions(+), 1 deletion(-)
---
diff --git a/tools/wixl/builder.vala b/tools/wixl/builder.vala
index 3ad7fab..708cda5 100644
--- a/tools/wixl/builder.vala
+++ b/tools/wixl/builder.vala
@@ -1067,10 +1067,17 @@ namespace Wixl {
                 type = CustomActionType.JSCRIPT_BINARY;
                 source = action.BinaryKey;
                 target = action.JScriptCall;
-            } else if (action.ExeCommand != null) {
+            } else if (action.ExeCommand != null && action.FileKey == null) {
                 type = CustomActionType.EXE_PROPERTY;
                 source = action.Property;
                 target = action.ExeCommand;
+            } else if (action.ExeCommand != null && action.FileKey != null) {
+                if (find_element<WixFile>(action.FileKey) == null)
+                    error ("file reference '%s' not defined", action.FileKey);
+
+                type = CustomActionType.EXE_FILE;
+                source = action.FileKey;
+                target = action.ExeCommand;
             } else
                 throw new Wixl.Error.FAILED ("Unsupported CustomAction");
 
diff --git a/tools/wixl/wix.vala b/tools/wixl/wix.vala
index f522793..5102870 100644
--- a/tools/wixl/wix.vala
+++ b/tools/wixl/wix.vala
@@ -918,6 +918,7 @@ namespace Wixl {
 
         public string Property { get; set; }
         public string Execute { get; set; }
+        public string FileKey { get; set; }
         public string ExeCommand { get; set; }
         public string Impersonate { get; set; }
         public string Return { get; set; }


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