@@ -726,38 +726,26 @@ pub fn build_wix_app_installer(
726726 ) ;
727727
728728 // Create the update task XML
729- let mut skip_uac_task = Handlebars :: new ( ) ;
729+ let skip_uac_task = Handlebars :: new ( ) ;
730730 let xml = include_str ! ( "./update-task.xml" ) ;
731- skip_uac_task
732- . register_template_string ( "update.xml" , xml)
733- . map_err ( |e| e. to_string ( ) )
734- . expect ( "Failed to setup Update Task handlebars" ) ;
731+ let update_content = skip_uac_task. render_template ( xml, & data) ?;
735732 let temp_xml_path = output_path. join ( "update.xml" ) ;
736- let update_content = skip_uac_task. render ( "update.xml" , & data) ?;
737733 fs:: write ( temp_xml_path, update_content) ?;
738734
739735 // Create the Powershell script to install the task
740736 let mut skip_uac_task_installer = Handlebars :: new ( ) ;
741737 skip_uac_task_installer. register_escape_fn ( handlebars:: no_escape) ;
742738 let xml = include_str ! ( "./install-task.ps1" ) ;
743- skip_uac_task_installer
744- . register_template_string ( "install-task.ps1" , xml)
745- . map_err ( |e| e. to_string ( ) )
746- . expect ( "Failed to setup Update Task Installer handlebars" ) ;
739+ let install_script_content = skip_uac_task_installer. render_template ( xml, & data) ?;
747740 let temp_ps1_path = output_path. join ( "install-task.ps1" ) ;
748- let install_script_content = skip_uac_task_installer. render ( "install-task.ps1" , & data) ?;
749741 fs:: write ( temp_ps1_path, install_script_content) ?;
750742
751743 // Create the Powershell script to uninstall the task
752744 let mut skip_uac_task_uninstaller = Handlebars :: new ( ) ;
753745 skip_uac_task_uninstaller. register_escape_fn ( handlebars:: no_escape) ;
754746 let xml = include_str ! ( "./uninstall-task.ps1" ) ;
755- skip_uac_task_uninstaller
756- . register_template_string ( "uninstall-task.ps1" , xml)
757- . map_err ( |e| e. to_string ( ) )
758- . expect ( "Failed to setup Update Task Uninstaller handlebars" ) ;
747+ let install_script_content = skip_uac_task_uninstaller. render_template ( xml, & data) ?;
759748 let temp_ps1_path = output_path. join ( "uninstall-task.ps1" ) ;
760- let install_script_content = skip_uac_task_uninstaller. render ( "uninstall-task.ps1" , & data) ?;
761749 fs:: write ( temp_ps1_path, install_script_content) ?;
762750
763751 data. insert ( "enable_elevated_update_task" , to_json ( true ) ) ;
@@ -772,7 +760,9 @@ pub fn build_wix_app_installer(
772760 let extension_regex = Regex :: new ( "\" http://schemas.microsoft.com/wix/(\\ w+)\" " ) ?;
773761 for fragment_path in fragment_paths {
774762 let fragment_path = current_dir. join ( fragment_path) ;
775- let fragment = fs:: read_to_string ( & fragment_path) ?;
763+ let fragment_content = fs:: read_to_string ( & fragment_path) ?;
764+ let fragment_handlebars = Handlebars :: new ( ) ;
765+ let fragment = fragment_handlebars. render_template ( & fragment_content, & data) ?;
776766 let mut extensions = Vec :: new ( ) ;
777767 for cap in extension_regex. captures_iter ( & fragment) {
778768 extensions. push ( wix_toolset_path. join ( format ! ( "Wix{}.dll" , & cap[ 1 ] ) ) ) ;
0 commit comments