Skip to content

Commit be3e6a2

Browse files
AlexKlimajHTRamsey
authored andcommitted
windows installer: handle missing uninstaller
1 parent a237215 commit be3e6a2

File tree

1 file changed

+18
-1
lines changed

1 file changed

+18
-1
lines changed

deploy/windows/nullsoft_installer.nsi

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,24 @@ Section "Install" SecMain
6363
DetailPrint "Checking for 64 bit uninstaller"
6464
SetRegView 64
6565
ReadRegStr $R0 HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPNAME}" "UninstallString"
66-
StrCmp $R0 "" doInstall doUninstall
66+
StrCmp $R0 "" doInstall checkUninstaller
67+
68+
checkUninstaller:
69+
; Remove quotes from uninstaller path to check if file exists
70+
StrCpy $R1 $R0 "" 1 ; Skip first quote
71+
StrLen $R2 $R1
72+
IntOp $R2 $R2 - 1 ; Remove last quote
73+
StrCpy $R1 $R1 $R2
74+
75+
DetailPrint "Checking if uninstaller exists: $R1"
76+
IfFileExists "$R1" doUninstall cleanupOrphanedRegistry
77+
78+
cleanupOrphanedRegistry:
79+
DetailPrint "Previous uninstaller not found, cleaning up orphaned registry keys..."
80+
SetRegView 64
81+
DeleteRegKey HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\${APPNAME}"
82+
DeleteRegKey HKLM "SOFTWARE\Microsoft\Windows\Windows Error Reporting\LocalDumps\${EXENAME}.exe"
83+
Goto doInstall
6784

6885
doUninstall:
6986
DetailPrint "Uninstalling previous version..."

0 commit comments

Comments
 (0)