-
Notifications
You must be signed in to change notification settings - Fork 5
/
uninstall.nsi
61 lines (46 loc) · 1.99 KB
/
uninstall.nsi
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
; Uninstaller script for Ansys Python Manager
; Name and version of the program to be uninstalled are already defined
Var DeleteDefaultVenvPath
Var DeleteConfiguration
; Define the uninstaller section
Section "Uninstall"
; Prompt the user to confirm uninstallation
MessageBox MB_YESNO|MB_ICONQUESTION "Are you sure you want to uninstall ${PRODUCT_NAME} ${PRODUCT_VERSION}?" IDYES checkDeleteVenvPath
Abort
checkDeleteVenvPath:
MessageBox MB_YESNO|MB_ICONQUESTION "Do you want to delete the contents in the default virtual environment path location?" IDYES deleteVenvPath
StrCpy $DeleteDefaultVenvPath 0
Goto checkDeleteConfiguration
deleteVenvPath:
StrCpy $DeleteDefaultVenvPath 1
Goto checkDeleteConfiguration
checkDeleteConfiguration:
MessageBox MB_YESNO|MB_ICONQUESTION "Do you want to delete the Ansys Python Manager stored configuration?" IDYES deleteConfiguration
StrCpy $DeleteConfiguration 0
Goto doneAsking
deleteConfiguration:
StrCpy $DeleteConfiguration 1
Goto doneAsking
doneAsking:
; Echo the values of $DeleteConfiguration and $DeleteDefaultVenvPath
DetailPrint "User home: $PROFILE"
DetailPrint "DeleteConfiguration: $DeleteConfiguration"
DetailPrint "DeleteDefaultVenvPath: $DeleteDefaultVenvPath"
; Delete directories if required
${If} $DeleteDefaultVenvPath == 1
RMDir /r "$PROFILE\.ansys_python_venvs"
${EndIf}
${If} $DeleteConfiguration == 1
RMDir /r "$PROFILE\.ansys\ansys_python_manager"
${EndIf}
; Remove the installed files
Delete "$INSTDIR\*.*"
RMDir /r /REBOOTOK "$INSTDIR"
; Remove the registry keys
DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}"
; Remove the start menu shortcut and directory
Delete "$SMPROGRAMS\Ansys Python Manager\Ansys Python Manager.lnk"
RMDir /r /REBOOTOK "$SMPROGRAMS\Ansys Python Manager"
; Display the uninstallation complete message
MessageBox MB_OK|MB_ICONINFORMATION "${PRODUCT_NAME} ${PRODUCT_VERSION} has been successfully uninstalled."
SectionEnd