[msitools: 1/2] Strip scheduling condition nodes.




commit bd25513d41dfdbb84470b4db1e2d1857300a967e
Author: roblabla <unfiltered roblab la>
Date:   Sat Nov 13 00:44:31 2021 +0100

    Strip scheduling condition nodes.
    
    The Windows Installer parser for conditions does not like leading or
    trailing spaces. This means that fairly common constructs like
    
        <Custom Action='dostuff' After='InstallServices'>
            (NOT Installed) AND (NOT REMOVE)
        </Custom>
    
    will have the "wrong" condition `    (NOT Installed) AND (NOT REMOVE)`,
    leading to the windows installer framework raising an error when
    executing the action.
    
    To avoid this, we simply strip the leading and trailing spaces of
    conditions.

 tools/wixl/builder.vala | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
---
diff --git a/tools/wixl/builder.vala b/tools/wixl/builder.vala
index 319006d..1196f84 100644
--- a/tools/wixl/builder.vala
+++ b/tools/wixl/builder.vala
@@ -846,7 +846,7 @@ namespace Wixl {
             return_if_fail (condition.children.length () == 1);
             var text = condition.children.first ().data as WixText;
 
-            db.table_launch_condition.add (text.Text, condition.Message);
+            db.table_launch_condition.add (text.Text.strip(), condition.Message);
         }
 
         [Flags]
@@ -926,7 +926,7 @@ namespace Wixl {
             } else if (action.children.length () > 0) {
                 return_if_fail (action.children.length () == 1);
                 var text = action.children.first ().data as WixText;
-                node.condition = text.Text;
+                node.condition = text.Text.strip();
             }
         }
 
@@ -1318,7 +1318,7 @@ namespace Wixl {
                 // use the inner text from this element
                 return_if_fail (text.children.length () == 1);
                 var node = text.children.first ().data as WixText;
-                control.Text = node.Text;
+                control.Text = node.Text.strip();
             }
         }
 


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