@@ -615,7 +615,7 @@ pub fn build_wix_app_installer(
615615 let mut fragment_paths = Vec :: new ( ) ;
616616 let mut handlebars = Handlebars :: new ( ) ;
617617 handlebars. register_escape_fn ( handlebars:: no_escape) ;
618- let mut has_custom_template = false ;
618+ let mut custom_template_path = None ;
619619 let mut enable_elevated_update_task = false ;
620620
621621 if let Some ( wix) = & settings. windows ( ) . wix {
@@ -626,15 +626,7 @@ pub fn build_wix_app_installer(
626626 data. insert ( "merge_refs" , to_json ( & wix. merge_refs ) ) ;
627627 fragment_paths = wix. fragment_paths . clone ( ) ;
628628 enable_elevated_update_task = wix. enable_elevated_update_task ;
629-
630- if let Some ( temp_path) = & wix. template {
631- let template = read_to_string ( temp_path) ?;
632- handlebars
633- . register_template_string ( "main.wxs" , & template)
634- . map_err ( |e| e. to_string ( ) )
635- . expect ( "Failed to setup custom handlebar template" ) ;
636- has_custom_template = true ;
637- }
629+ custom_template_path = wix. template . clone ( ) ;
638630
639631 if let Some ( banner_path) = & wix. banner_path {
640632 let filename = banner_path
@@ -661,7 +653,12 @@ pub fn build_wix_app_installer(
661653 }
662654 }
663655
664- if !has_custom_template {
656+ if let Some ( path) = custom_template_path {
657+ handlebars
658+ . register_template_string ( "main.wxs" , read_to_string ( path) ?)
659+ . map_err ( |e| e. to_string ( ) )
660+ . expect ( "Failed to setup custom handlebar template" ) ;
661+ } else {
665662 handlebars
666663 . register_template_string ( "main.wxs" , include_str ! ( "../templates/main.wxs" ) )
667664 . map_err ( |e| e. to_string ( ) )
0 commit comments