Installer: Check if Zotero is running before installing (#4760)
This commit is contained in:
parent
a6c9af3c28
commit
ba45c72dc0
3 changed files with 49 additions and 0 deletions
|
@ -46,6 +46,11 @@ for plugin in $plugins; do
|
|||
curl https://hg.mozilla.org/mozilla-central/raw-file/052d53200cf8/other-licenses/nsis/Plugins/$plugin.dll > $plugin.dll
|
||||
done
|
||||
|
||||
curl https://nsis.sourceforge.io/mediawiki/images/1/18/NsProcess.zip > NsProcess.zip
|
||||
7z e NsProcess.zip "Plugin/nsProcessW.dll"
|
||||
mv nsProcessW.dll nsProcess.dll
|
||||
rm NsProcess.zip
|
||||
|
||||
echo
|
||||
echo
|
||||
echo "Files downloaded to ./Plugins -- move to ${NSIS_DIR}Plugins"
|
||||
|
|
|
@ -59,6 +59,7 @@ Var InstallType
|
|||
!insertmacro WordFind
|
||||
!insertmacro WordReplace
|
||||
|
||||
!include nsProcess.nsh
|
||||
; The following includes are custom.
|
||||
!include branding.nsi
|
||||
!include defines.nsi
|
||||
|
@ -962,6 +963,21 @@ Function .onInit
|
|||
${EndIf}
|
||||
!endif
|
||||
|
||||
# Check if Zotero is running. If it is, prompt the user to close Zotero and exit.
|
||||
# For silent installs, kill Zotero and if successful, continue with the install.
|
||||
${nsProcess::FindProcess} ${FileMainEXE} $R0
|
||||
${If} $R0 = 0
|
||||
IfSilent +3
|
||||
MessageBox MB_OK|MB_ICONSTOP "Zotero is already running. Please close Zotero before running the installer."
|
||||
Quit
|
||||
${nsProcess::KillProcess} ${FileMainEXE} $R0
|
||||
Sleep 500
|
||||
${nsProcess::FindProcess} ${FileMainEXE} $R0
|
||||
${If} $R0 = 0
|
||||
Quit
|
||||
${EndIf}
|
||||
${EndIf}
|
||||
|
||||
StrCpy $R1 "Zotero Standalone"
|
||||
StrCpy $R2 "An older version of Zotero is installed. If you continue, the existing version will be removed.$\n$\nYour Zotero data will not be affected."
|
||||
Call UninstallOld
|
||||
|
|
28
app/win/installer/nsProcess.nsh
Normal file
28
app/win/installer/nsProcess.nsh
Normal file
|
@ -0,0 +1,28 @@
|
|||
!define nsProcess::FindProcess `!insertmacro nsProcess::FindProcess`
|
||||
|
||||
!macro nsProcess::FindProcess _FILE _ERR
|
||||
nsProcess::_FindProcess /NOUNLOAD `${_FILE}`
|
||||
Pop ${_ERR}
|
||||
!macroend
|
||||
|
||||
|
||||
!define nsProcess::KillProcess `!insertmacro nsProcess::KillProcess`
|
||||
|
||||
!macro nsProcess::KillProcess _FILE _ERR
|
||||
nsProcess::_KillProcess /NOUNLOAD `${_FILE}`
|
||||
Pop ${_ERR}
|
||||
!macroend
|
||||
|
||||
!define nsProcess::CloseProcess `!insertmacro nsProcess::CloseProcess`
|
||||
|
||||
!macro nsProcess::CloseProcess _FILE _ERR
|
||||
nsProcess::_CloseProcess /NOUNLOAD `${_FILE}`
|
||||
Pop ${_ERR}
|
||||
!macroend
|
||||
|
||||
|
||||
!define nsProcess::Unload `!insertmacro nsProcess::Unload`
|
||||
|
||||
!macro nsProcess::Unload
|
||||
nsProcess::_Unload
|
||||
!macroend
|
Loading…
Reference in a new issue