Skip to content

Commit 9b2fb32

Browse files
authored
feat: adding Windows uninstall config and venvs sections (#236)
1 parent 80bd667 commit 9b2fb32

File tree

1 file changed

+37
-1
lines changed

1 file changed

+37
-1
lines changed

uninstall.nsi

Lines changed: 37 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,49 @@
22

33
; Name and version of the program to be uninstalled are already defined
44

5+
Var DeleteDefaultVenvPath
6+
Var DeleteConfiguration
57

68
; Define the uninstaller section
79
Section "Uninstall"
810
; Prompt the user to confirm uninstallation
9-
MessageBox MB_YESNO|MB_ICONQUESTION "Are you sure you want to uninstall ${PRODUCT_NAME} ${PRODUCT_VERSION}?" /SD IDYES IDYES +2
11+
MessageBox MB_YESNO|MB_ICONQUESTION "Are you sure you want to uninstall ${PRODUCT_NAME} ${PRODUCT_VERSION}?" /SD IDYES IDYES checkDeleteVenvPath
1012
Abort
1113

14+
checkDeleteVenvPath:
15+
MessageBox MB_YESNO "Do you want to delete the contents in the default virtual environment path location?" IDYES deleteVenvPath
16+
StrCpy $DeleteDefaultVenvPath 0
17+
Goto checkDeleteConfiguration
18+
19+
deleteVenvPath:
20+
StrCpy $DeleteDefaultVenvPath 1
21+
Goto checkDeleteConfiguration
22+
23+
checkDeleteConfiguration:
24+
MessageBox MB_YESNO "Do you want to delete the Ansys Python Manager stored configuration?" IDYES deleteConfiguration
25+
StrCpy $DeleteConfiguration 0
26+
Goto doneAsking
27+
28+
deleteConfiguration:
29+
StrCpy $DeleteConfiguration 1
30+
Goto doneAsking
31+
32+
doneAsking:
33+
34+
; Echo the values of $DeleteConfiguration and $DeleteDefaultVenvPath
35+
DetailPrint "User home: $PROFILE"
36+
DetailPrint "DeleteConfiguration: $DeleteConfiguration"
37+
DetailPrint "DeleteDefaultVenvPath: $DeleteDefaultVenvPath"
38+
39+
40+
; Delete directories if required
41+
${If} $DeleteDefaultVenvPath == 1
42+
RMDir /r "$PROFILE\.ansys_python_venvs"
43+
${EndIf}
44+
${If} $DeleteConfiguration == 1
45+
RMDir /r "$PROFILE\.ansys"
46+
${EndIf}
47+
1248
; Remove the installed files
1349
Delete "$INSTDIR\*.*"
1450
RMDir /r /REBOOTOK "$INSTDIR"

0 commit comments

Comments
 (0)