Skip to content

Commit

Permalink
Remove "Standalone" from Windows app name and improve (un)installer
Browse files Browse the repository at this point in the history
- Remove all references to "Standalone" in the shortcut, installation
  path, registry, etc.
- Remove the previous "Zotero Standalone" directory in Program Files
- Set uninstall entry as just "Zotero", with "Corporation for Digital
  Scholarship" as the Publisher and the correct version in the Version
  field. Previously we included the version number in the name, which
  some programs do, but we weren't properly updating the entry on in-app
  upgrade, so it was usually just wrong.
- Add uninstaller steps to try to remove files that were added in an
  in-app update. For some reason we're not properly populating the
  uninstall log on update (possibly because we're using an outdated
  Firefox 39 upgrader to avoid checks for Mozilla-signed MARs), so
  new/moved files were being left behind after an uninstall. If we do
  additional Firefox updates on Windows, we may need to update the file
  list, but hopefully we'll just stay on 52 ESR and then switch to
  Electron.
  • Loading branch information
dstillman committed Jun 29, 2017
1 parent c95e048 commit 199a389
Show file tree
Hide file tree
Showing 7 changed files with 113 additions and 11 deletions.
4 changes: 2 additions & 2 deletions assets/application.ini
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ Vendor=Zotero
Name=Zotero
Version={{VERSION}}
BuildID={{BUILDID}}
Copyright=Copyright (c) 2006-2016 Contributors
Copyright=Copyright (c) 2006-2017 Contributors
ID=zotero@chnm.gmu.edu

[Gecko]
MinVersion=45.0
MinVersion=52.0
MaxVersion=54.*

[XRE]
Expand Down
2 changes: 1 addition & 1 deletion win/installer/app.tag
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
;!@Install@!UTF-8!
Title="Zotero Standalone"
Title="Zotero"
RunProgram="setup.exe"
;!@InstallEnd@!
8 changes: 4 additions & 4 deletions win/installer/branding.nsi
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

# BrandFullNameInternal is used for some registry and file system values
# instead of BrandFullName and typically should not be modified.
!define BrandFullNameInternal "Zotero Standalone"
!define CompanyName "zotero.org"
!define URLInfoAbout "http://www.zotero.org"
!define URLUpdateInfo "http://www.zotero.org/standalone"
!define BrandFullNameInternal "Zotero"
!define CompanyName "Corporation for Digital Scholarship"
!define URLInfoAbout "https://www.zotero.org"
!define URLUpdateInfo "https://www.zotero.org"
2 changes: 1 addition & 1 deletion win/installer/defines.nsi
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
# handled in widget/src/windows/WinTaskbar.cpp.

!define AppVendor "Zotero"
!define AppName "Standalone"
!define AppName "Zotero"
!define AppVersion "{{VERSION}}"
!define AppUserModelID "${AppVendor}.${AppName}.${AppVersion}"
!define GREVersion 2.0
Expand Down
59 changes: 59 additions & 0 deletions win/installer/installer.nsi
Original file line number Diff line number Diff line change
Expand Up @@ -859,6 +859,65 @@ Function .onInit

${InstallOnInitCommon} "$(WARN_MIN_SUPPORTED_OS_MSG)"

; If a version beginning with "Zotero Standalone" is installed, uninstall that first, since we're now
; just "Zotero"
StrCpy $0 0
enum_uninst_keys:
EnumRegKey $1 HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall" $0
StrCmp $1 "" continue_installation
; "Zotero Standalone" included a version suffix, so check the beginning
StrCpy $2 $1 17
StrCmp $2 "Zotero Standalone" get_uninst_exe
IntOp $0 $0 + 1
Goto enum_uninst_keys

get_uninst_exe:
ReadRegStr $2 HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\$1" "UninstallString"
ReadRegStr $3 HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\$1" "InstallLocation"

MessageBox MB_OKCANCEL|MB_ICONEXCLAMATION \
"An older version of Zotero is installed. $\n$\nIf you continue, the existing version \
will be removed. Your Zotero data will not be affected." \
/SD IDOK IDOK uninst
Abort

uninst:
; This doesn't actually wait, since the uninstaller copies itself to a temp folder, runs that,
; and exits, so give it a few seconds to finish
ExecWait '"$2" /S'
Sleep 3000

; Files that were added by an in-app update won't be automatically deleted by the 4.0 uninstaller,
; so manually delete everything we know about as long as the directory name begins with "Zotero".
; We don't just delete the directory because we don't know for sure that the user didn't do
; something crazy like put their data directory in it.
${GetFileName} $3 $4
StrCpy $5 $4 6
StrCmp $5 "Zotero" +1 continue_installation
RMDir /r /REBOOTOK "$3\chrome"
RMDir /r /REBOOTOK "$3\components"
RMDir /r /REBOOTOK "$3\defaults"
RMDir /r /REBOOTOK "$3\dictionaries"
RMDir /r /REBOOTOK "$3\extensions"
RMDir /r /REBOOTOK "$3\fonts"
RMDir /r /REBOOTOK "$3\gmp-clearkey"
RMDir /r /REBOOTOK "$3\uninstall"
RMDir /r /REBOOTOK "$3\xulrunner"
Delete /REBOOTOK "$3\*.chk"
Delete /REBOOTOK "$3\*.dll"
Delete /REBOOTOK "$3\*.exe"
Delete /REBOOTOK "$3\Accessible.tlb"
Delete /REBOOTOK "$3\dependentlibs.list"
Delete /REBOOTOK "$3\firefox.VisualElementsManifest.xml"
Delete /REBOOTOK "$3\omni.ja"
Delete /REBOOTOK "$3\platform.ini"
Delete /REBOOTOK "$3\precomplete"
Delete /REBOOTOK "$3\voucher.bin"
RMDir /REBOOTOK $3
continue_installation:
; End uninstallation


!insertmacro InitInstallOptionsFile "options.ini"
!insertmacro InitInstallOptionsFile "shortcuts.ini"
!insertmacro InitInstallOptionsFile "summary.ini"
Expand Down
4 changes: 2 additions & 2 deletions win/installer/shared.nsh
Original file line number Diff line number Diff line change
Expand Up @@ -190,10 +190,10 @@
; Write the uninstall registry keys
${WriteRegStr2} $1 "$0" "Comments" "${BrandFullNameInternal} ${AppVersion} (${ARCH} ${AB_CD})" 0
${WriteRegStr2} $1 "$0" "DisplayIcon" "$8\${FileMainEXE},0" 0
${WriteRegStr2} $1 "$0" "DisplayName" "${BrandFullNameInternal} ${AppVersion} (${ARCH} ${AB_CD})" 0
${WriteRegStr2} $1 "$0" "DisplayName" "${BrandFullNameInternal}" 0
${WriteRegStr2} $1 "$0" "DisplayVersion" "${AppVersion}" 0
${WriteRegStr2} $1 "$0" "InstallLocation" "$8" 0
${WriteRegStr2} $1 "$0" "Publisher" "Zotero" 0
${WriteRegStr2} $1 "$0" "Publisher" "Corporation for Digital Scholarship" 0
${WriteRegStr2} $1 "$0" "UninstallString" "$8\uninstall\helper.exe" 0
${WriteRegStr2} $1 "$0" "URLInfoAbout" "${URLInfoAbout}" 0
${WriteRegStr2} $1 "$0" "URLUpdateInfo" "${URLUpdateInfo}" 0
Expand Down
45 changes: 44 additions & 1 deletion win/installer/uninstaller.nsi
Original file line number Diff line number Diff line change
Expand Up @@ -274,12 +274,55 @@ Section "Uninstall"
${EndIf}

; Remove the updates directory for Vista and above
${un.CleanUpdatesDir} "Zotero\Standalone"
${un.CleanUpdatesDir} "Zotero\Zotero"

; Parse the uninstall log to unregister dll's and remove all installed
; files / directories this install is responsible for.
${un.ParseUninstallLog}

; Files that were added by an in-app update aren't currently being added to the uninstall log,
; so manually delete everything we know about as long as the directory name begins with "Zotero".
; We don't just delete the directory because we don't know for sure that the user didn't do
; something crazy like put their data directory in it.
${GetFileName} $INSTDIR $R1
StrCpy $R2 $R1 6
StrCmp $R2 "Zotero" +1 post_delete
${If} ${FileExists} "$INSTDIR\chrome"
RMDir /r /REBOOTOK "$INSTDIR\chrome"
${EndIF}
${If} ${FileExists} "$INSTDIR\components"
RMDir /r /REBOOTOK "$INSTDIR\components"
${EndIF}
${If} ${FileExists} "$INSTDIR\defaults"
RMDir /r /REBOOTOK "$INSTDIR\defaults"
${EndIF}
${If} ${FileExists} "$INSTDIR\dictionaries"
RMDir /r /REBOOTOK "$INSTDIR\dictionaries"
${EndIF}
${If} ${FileExists} "$INSTDIR\extensions"
RMDir /r /REBOOTOK "$INSTDIR\extensions"
${EndIF}
${If} ${FileExists} "$INSTDIR\fonts"
RMDir /r /REBOOTOK "$INSTDIR\fonts"
${EndIF}
${If} ${FileExists} "$INSTDIR\gmp-clearkey"
RMDir /r /REBOOTOK "$INSTDIR\gmp-clearkey"
${EndIF}
${If} ${FileExists} "$INSTDIR\xulrunner"
RMDir /r /REBOOTOK "$INSTDIR\xulrunner"
${EndIF}
Delete /REBOOTOK "$INSTDIR\*.chk"
Delete /REBOOTOK "$INSTDIR\*.dll"
Delete /REBOOTOK "$INSTDIR\*.exe"
Delete /REBOOTOK "$INSTDIR\Accessible.tlb"
Delete /REBOOTOK "$INSTDIR\dependentlibs.list"
Delete /REBOOTOK "$INSTDIR\firefox.VisualElementsManifest.xml"
Delete /REBOOTOK "$INSTDIR\omni.ja"
Delete /REBOOTOK "$INSTDIR\platform.ini"
Delete /REBOOTOK "$INSTDIR\precomplete"
Delete /REBOOTOK "$INSTDIR\voucher.bin"
post_delete:

; Remove the uninstall directory that we control
RmDir /r /REBOOTOK "$INSTDIR\uninstall"

Expand Down

0 comments on commit 199a389

Please sign in to comment.