Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 37 additions & 1 deletion uninstall.nsi
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,49 @@

; 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}?" /SD IDYES IDYES +2
MessageBox MB_YESNO|MB_ICONQUESTION "Are you sure you want to uninstall ${PRODUCT_NAME} ${PRODUCT_VERSION}?" /SD IDYES IDYES checkDeleteVenvPath
Abort

checkDeleteVenvPath:
MessageBox MB_YESNO "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 "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"
${EndIf}

; Remove the installed files
Delete "$INSTDIR\*.*"
RMDir /r /REBOOTOK "$INSTDIR"
Expand Down