diff --git a/uninstall.nsi b/uninstall.nsi index fd115fb3..545e4cac 100644 --- a/uninstall.nsi +++ b/uninstall.nsi @@ -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"