Skip to content

Commit 2f92c6c

Browse files
authored
fix(installer): avoid files are deleted on system reboot after reinstallation (#1520)
* fix(installer): avoid files are deleted on system reboot when weasel is reinstalled in the same WeaselRoot * fix(installer): remove old version files with installer, not uninstaller.exe
1 parent 41dc044 commit 2f92c6c

File tree

1 file changed

+38
-11
lines changed

1 file changed

+38
-11
lines changed

output/install.nsi

Lines changed: 38 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,34 @@ uninst:
161161
CopyFiles $R1\data\*.* $TEMP\weasel-backup
162162

163163
call_uninstaller:
164-
ExecWait '$R0 /S'
164+
ExecWait '"$R1\WeaselServer.exe" /quit'
165+
ExecWait '"$R1\WeaselSetup.exe" /u'
166+
; Remove registry keys
167+
DeleteRegKey HKLM SOFTWARE\Rime
168+
DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Weasel"
169+
; don't redirect on 64 bit system for auto run setting
170+
${If} ${IsNativeARM64}
171+
SetRegView 64
172+
${ElseIf} ${IsNativeAMD64}
173+
SetRegView 64
174+
${Endif}
175+
DeleteRegValue HKLM "Software\Microsoft\Windows\CurrentVersion\Run" "WeaselServer"
176+
; recover back to 32bit view
177+
SetRegView 32
178+
; Remove files and uninstaller
179+
Delete "$R1\data\opencc\*.*"
180+
Delete "$R1\data\preview\*.*"
181+
Delete "$R1\data\*.*"
182+
Delete "$R1\*.*"
183+
RMDir "$R1\data\opencc"
184+
RMDir "$R1\data\preview"
185+
RMDir "$R1\data"
186+
RMDir "$R1"
187+
SetShellVarContext all
188+
Delete "$SMPROGRAMS\$(DISPLAYNAME)\*.*"
189+
RMDir "$SMPROGRAMS\$(DISPLAYNAME)"
190+
; Prompt reboot
191+
SetRebootFlag true
165192
Sleep 800
166193

167194
done:
@@ -378,17 +405,17 @@ Section "Uninstall"
378405

379406
; Remove files and uninstaller
380407
SetOutPath $TEMP
381-
Delete /REBOOTOK "$INSTDIR\data\opencc\*.*"
382-
Delete /REBOOTOK "$INSTDIR\data\preview\*.*"
383-
Delete /REBOOTOK "$INSTDIR\data\*.*"
384-
Delete /REBOOTOK "$INSTDIR\*.*"
385-
RMDir /REBOOTOK "$INSTDIR\data\opencc"
386-
RMDir /REBOOTOK "$INSTDIR\data\preview"
387-
RMDir /REBOOTOK "$INSTDIR\data"
388-
RMDir /REBOOTOK "$INSTDIR"
408+
Delete "$INSTDIR\data\opencc\*.*"
409+
Delete "$INSTDIR\data\preview\*.*"
410+
Delete "$INSTDIR\data\*.*"
411+
Delete "$INSTDIR\*.*"
412+
RMDir "$INSTDIR\data\opencc"
413+
RMDir "$INSTDIR\data\preview"
414+
RMDir "$INSTDIR\data"
415+
RMDir "$INSTDIR"
389416
SetShellVarContext all
390-
Delete /REBOOTOK "$SMPROGRAMS\$(DISPLAYNAME)\*.*"
391-
RMDir /REBOOTOK "$SMPROGRAMS\$(DISPLAYNAME)"
417+
Delete "$SMPROGRAMS\$(DISPLAYNAME)\*.*"
418+
RMDir "$SMPROGRAMS\$(DISPLAYNAME)"
392419

393420
; Prompt reboot
394421
SetRebootFlag true

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy