@@ -127,7 +127,7 @@ check_git_clean() {
127127
128128find_nsis_script () {
129129 find " $WORK_DIR /standalone-win-x64" \
130- \( -name " * .nsi" -o -name " *.nsh " \) \
130+ -name " installer .nsi" \
131131 -print \
132132 | head -1
133133}
@@ -136,22 +136,31 @@ rebuild_windows_installer() {
136136 local signed_exe=" $1 "
137137 local installer_path=" $2 "
138138
139- check_command makensis " Install NSIS (makensis) and re-download artifacts "
139+ check_command makensis " Install NSIS: brew install makensis "
140140
141141 local script_path
142142 script_path=$( find_nsis_script)
143- [[ -n " $script_path " ]] || error " NSIS script not found in downloaded artifacts; include bundle/nsis staging files before rebuilding the installer ."
143+ [[ -n " $script_path " ]] || error " NSIS script not found in downloaded artifacts; ensure release.yml uploads the nsis staging directory ."
144144
145145 local script_dir
146146 script_dir=" $( cd " $( dirname " $script_path " ) " && pwd) "
147- local bundle_root
148- bundle_root=" $( cd " $script_dir /.." && pwd) "
149147
150- local staged_exe
151- staged_exe=$( find " $bundle_root " -name " MouseTerm.exe" -not -path " $signed_exe " | head -1)
152- [[ -n " $staged_exe " ]] || error " Could not find staged MouseTerm.exe for NSIS rebuild"
153-
154- cp " $signed_exe " " $staged_exe "
148+ # The .nsi contains absolute Windows paths that don't exist on macOS.
149+ # Patch MAINBINARYSRCPATH to point to the signed exe.
150+ local abs_signed_exe
151+ abs_signed_exe=" $( cd " $( dirname " $signed_exe " ) " && pwd) /$( basename " $signed_exe " ) "
152+ sed -i ' ' " s|^!define MAINBINARYSRCPATH .*|!define MAINBINARYSRCPATH \" $abs_signed_exe \" |" " $script_path "
153+
154+ # Patch ADDITIONALPLUGINSPATH to point to the plugin bundled in artifacts.
155+ local plugin_dir
156+ plugin_dir=$( find " $WORK_DIR /standalone-win-x64" -name " nsis_tauri_utils.dll" -exec dirname {} \; | head -1)
157+ if [[ -n " $plugin_dir " ]]; then
158+ local abs_plugin_dir
159+ abs_plugin_dir=" $( cd " $plugin_dir " && pwd) "
160+ sed -i ' ' " s|^!define ADDITIONALPLUGINSPATH .*|!define ADDITIONALPLUGINSPATH \" $abs_plugin_dir \" |" " $script_path "
161+ else
162+ warn " nsis_tauri_utils.dll not found in artifacts; makensis may fail"
163+ fi
155164
156165 local installer_name
157166 installer_name=" $( basename " $installer_path " ) "
@@ -163,7 +172,9 @@ rebuild_windows_installer() {
163172 makensis -NOCD -X" OutFile $installer_name " " $( basename " $script_path " ) "
164173 )
165174
166- [[ -f " $installer_path " ]] || error " NSIS rebuild did not produce $installer_path "
175+ local output_path=" $script_dir /$installer_name "
176+ [[ -f " $output_path " ]] || error " NSIS rebuild did not produce $installer_name "
177+ mv " $output_path " " $installer_path "
167178}
168179
169180resolve_tag_sha () {
0 commit comments