Browse Source

The installer now checks if qbt is running before proceeding.

adaptive-webui-19844
sledgehammer999 12 years ago
parent
commit
78ee01b03c
  1. 4
      src/windows/installer-translations/english.nsi
  2. 16
      src/windows/installer.nsi
  3. 2
      src/windows/options.nsi
  4. 14
      src/windows/uninstaller.nsi

4
src/windows/installer-translations/english.nsi

@ -12,6 +12,8 @@ LangString inst_torrent ${LANG_ENGLISH} "Open .torrent files with qBittorrent" @@ -12,6 +12,8 @@ LangString inst_torrent ${LANG_ENGLISH} "Open .torrent files with qBittorrent"
LangString inst_magnet ${LANG_ENGLISH} "Open magnet links with qBittorrent"
;LangString inst_firewall ${LANG_ENGLISH} "Add Windows Firewall rule"
LangString inst_firewall ${LANG_ENGLISH} "Add Windows Firewall rule"
;LangString inst_warning ${LANG_ENGLISH} "qBittorrent is running. Please close the application before installing."
LangString inst_warning ${LANG_ENGLISH} "qBittorrent is running. Please close the application before installing."
;------------------------------------
@ -31,3 +33,5 @@ LangString remove_conf ${LANG_ENGLISH} "Remove configuration files" @@ -31,3 +33,5 @@ LangString remove_conf ${LANG_ENGLISH} "Remove configuration files"
LangString remove_firewall ${LANG_ENGLISH} "Remove Windows Firewall rule"
;LangString remove_cache ${LANG_ENGLISH} "Remove torrents and cached data"
LangString remove_cache ${LANG_ENGLISH} "Remove torrents and cached data"
;LangString uninst_warning ${LANG_ENGLISH} "qBittorrent is running. Please close the application before uninstalling."
LangString uninst_warning ${LANG_ENGLISH} "qBittorrent is running. Please close the application before uninstalling."

16
src/windows/installer.nsi

@ -107,7 +107,7 @@ SectionEnd @@ -107,7 +107,7 @@ SectionEnd
;--------------------------------
Function .onInit
Function .onInit
;Search if qBittorrent is already installed.
FindFirst $0 $1 "$INSTDIR\uninst.exe"
FindClose $0
@ -128,3 +128,17 @@ Function .onInit @@ -128,3 +128,17 @@ Function .onInit
!insertmacro MUI_LANGDLL_DISPLAY
FunctionEnd
Function check_instance
check:
FindProcDLL::FindProc "qbittorrent.exe"
StrCmp $R0 "1" 0 notfound
MessageBox MB_RETRYCANCEL|MB_ICONEXCLAMATION $(inst_warning) IDRETRY check IDCANCEL done
done:
Abort
notfound:
FunctionEnd

2
src/windows/options.nsi

@ -65,6 +65,7 @@ RequestExecutionLevel admin @@ -65,6 +65,7 @@ RequestExecutionLevel admin
;Installer Pages
!insertmacro MUI_PAGE_WELCOME
!insertmacro MUI_PAGE_LICENSE "license.txt"
!define MUI_PAGE_CUSTOMFUNCTION_LEAVE check_instance
!insertmacro MUI_PAGE_COMPONENTS
!insertmacro MUI_PAGE_DIRECTORY
!insertmacro MUI_PAGE_INSTFILES
@ -73,6 +74,7 @@ RequestExecutionLevel admin @@ -73,6 +74,7 @@ RequestExecutionLevel admin
;--------------------------------
;Uninstaller Pages
!insertmacro MUI_UNPAGE_CONFIRM
!define MUI_PAGE_CUSTOMFUNCTION_LEAVE un.check_instance
!insertmacro MUI_UNPAGE_COMPONENTS
!insertmacro MUI_UNPAGE_INSTFILES

14
src/windows/uninstaller.nsi

@ -90,3 +90,17 @@ Function un.onInit @@ -90,3 +90,17 @@ Function un.onInit
!insertmacro MUI_UNGETLANGUAGE
FunctionEnd
Function un.check_instance
check:
FindProcDLL::FindProc "qbittorrent.exe"
StrCmp $R0 "1" 0 notfound
MessageBox MB_RETRYCANCEL|MB_ICONEXCLAMATION $(uninst_warning) IDRETRY check IDCANCEL done
done:
Abort
notfound:
FunctionEnd

Loading…
Cancel
Save