Skip to content

Commit

Permalink
[ICIJ/datashare#360] removes previous datashare installs
Browse files Browse the repository at this point in the history
  • Loading branch information
bamthomas committed Mar 18, 2020
1 parent 9af7c07 commit 4e7dfb6
Showing 1 changed file with 24 additions and 6 deletions.
30 changes: 24 additions & 6 deletions windows/installDatashareStandalone.nsi
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,21 @@ Function InstallDatashare
pop $R0
FunctionEnd

Function UninstallPreviousDatashare
ClearErrors
FindFirst $0 $1 "$PROGRAMFILES64\Datashare*"
loop:
IfErrors done
DetailPrint "found previous datashare $1 calling uninstall"
ExecWait "$PROGRAMFILES64\$1\uninstall.exe /S"
IfErrors 0 +2
DetailPrint "uninstall of $1 failed"
FindNext $0 $1
Goto loop
done:
FindClose $0
FunctionEnd

Function InstallOpenJre64
#Java lib test
nsExec::ExecToStack "java -version"
Expand Down Expand Up @@ -177,6 +192,7 @@ FunctionEnd
Section "install"
${GetWindowsVersion} $R0
DetailPrint "Detected Windows $R0"
Call UninstallPreviousDatashare

${If} ${RunningX64}
Call InstallOpenJre64
Expand All @@ -200,14 +216,16 @@ section "uninstall"
rmDir /r "$APPDATA\Datashare\dist"
rmDir /r "$APPDATA\Datashare\index"
rmDir /r "$APPDATA\Datashare\app"
MessageBox MB_YESNO|MB_ICONQUESTION "Do you want to remove Datashare data directory ?" IDNO +3
rmDir /r "$APPDATA\Datashare\data"
rmDir /r "$DESKTOP\Datashare Data"
rmDir "$APPDATA\Datashare" # only if empty

IfSilent +5
MessageBox MB_YESNO|MB_ICONQUESTION "Do you want to remove Datashare data directory ?" IDNO +3
rmDir /r "$APPDATA\Datashare\data"
rmDir /r "$DESKTOP\Datashare Data"
rmDir "$APPDATA\Datashare" # only if empty

ReadRegStr $0 HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPNAME}" "GetWindowsVersion"
# Remove uninstaller information from the registry
DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPNAME}"

Call un.installTesseractOCR64
IfSilent +2
Call un.installTesseractOCR64
SectionEnd

0 comments on commit 4e7dfb6

Please sign in to comment.