File tree Expand file tree Collapse file tree
crates/tauri-bundler/src/bundle/windows Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ ---
2+ " tauri-bundler " : " patch:feat"
3+ ---
4+
5+ Store main binary name in registry for NSIS installer and delete old main binary on updates if the name changes.
6+
Original file line number Diff line number Diff line change @@ -546,8 +546,9 @@ pub fn build_wix_app_installer(
546546 let shortcut_guid = generate_package_guid ( settings) . to_string ( ) ;
547547 data. insert ( "shortcut_guid" , to_json ( shortcut_guid. as_str ( ) ) ) ;
548548
549- let app_exe_name = settings. main_binary_name ( ) . to_string ( ) ;
550- data. insert ( "app_exe_name" , to_json ( app_exe_name) ) ;
549+ // Note: `main_binary_name` is not used in our template but we keep it as it is potentially useful for custom temples
550+ let main_binary_name = settings. main_binary_name ( ) . to_string ( ) ;
551+ data. insert ( "main_binary_name" , to_json ( & main_binary_name) ) ;
551552
552553 let binaries = generate_binaries_data ( settings) ?;
553554
Original file line number Diff line number Diff line change @@ -636,6 +636,15 @@ Section Install
636636 WriteRegStr SHCTX " ${UNINSTKEY}" $MultiUser .InstallMode 1
637637 !endif
638638
639+ ; Remove old main binary if it doesn't match new main binary name
640+ ReadRegStr $0 SHCTX " ${UNINSTKEY}" " MainBinaryName"
641+ ${If} $0 != " ${MAINBINARYNAME}.exe"
642+ Delete " $INSTDIR\$0"
643+ ${EndIf}
644+
645+ ; Save current MAINBINARYNAME for future updates
646+ WriteRegStr SHCTX " ${UNINSTKEY}" " MainBinaryName" " ${MAINBINARYNAME}.exe"
647+
639648 ; Registry information for add/remove programs
640649 WriteRegStr SHCTX " ${UNINSTKEY}" " DisplayName" " ${PRODUCTNAME}"
641650 WriteRegStr SHCTX " ${UNINSTKEY}" " DisplayIcon" " $\" $INSTDIR\${MAINBINARYNAME}.exe$\" "
You can’t perform that action at this time.
0 commit comments