|
| 1 | +!include "LogicLib.nsh" |
| 2 | + |
| 3 | +Var NtTempPath |
| 4 | + |
| 5 | +!macro _RemoveDirIfExists DIR_PATH |
| 6 | + IfFileExists "${DIR_PATH}\*.*" 0 +4 |
| 7 | + DetailPrint "Removing ${DIR_PATH}" |
| 8 | + RMDir /r "${DIR_PATH}" |
| 9 | + ClearErrors |
| 10 | +!macroend |
| 11 | + |
| 12 | +!macro _RemoveFileIfExists FILE_PATH |
| 13 | + IfFileExists "${FILE_PATH}" 0 +3 |
| 14 | + DetailPrint "Deleting ${FILE_PATH}" |
| 15 | + Delete "${FILE_PATH}" |
| 16 | +!macroend |
| 17 | + |
| 18 | +!macro customUnInstall |
| 19 | + DetailPrint "Removing Nodetool Conda environment and settings" |
| 20 | + |
| 21 | + ; Remove Conda environments in common locations |
| 22 | + !insertmacro _RemoveDirIfExists "$COMMON_APPDATA\nodetool\conda_env" |
| 23 | + !insertmacro _RemoveDirIfExists "$APPDATA\nodetool\conda_env" |
| 24 | + !insertmacro _RemoveDirIfExists "$LOCALAPPDATA\nodetool\conda_env" |
| 25 | + |
| 26 | + ; Clean up paths relative to the current user profile if available |
| 27 | + ExpandEnvStrings $NtTempPath "%USERPROFILE%" |
| 28 | + StrCmp $NtTempPath "" skipUserPaths |
| 29 | + !insertmacro _RemoveDirIfExists "$NtTempPath\.nodetool\conda_env" |
| 30 | + !insertmacro _RemoveDirIfExists "$NtTempPath\.local\share\nodetool\conda_env" |
| 31 | + !insertmacro _RemoveDirIfExists "$NtTempPath\.config\nodetool" |
| 32 | + skipUserPaths: |
| 33 | + |
| 34 | + ; Clean up user-level configuration and caches |
| 35 | + !insertmacro _RemoveFileIfExists "$APPDATA\nodetool\settings.yaml" |
| 36 | + !insertmacro _RemoveDirIfExists "$APPDATA\nodetool\logs" |
| 37 | + |
| 38 | + ; Remove remaining Nodetool directories if empty |
| 39 | + !insertmacro _RemoveDirIfExists "$COMMON_APPDATA\nodetool" |
| 40 | + !insertmacro _RemoveDirIfExists "$APPDATA\nodetool" |
| 41 | + !insertmacro _RemoveDirIfExists "$LOCALAPPDATA\nodetool" |
| 42 | + StrCmp $NtTempPath "" doneUserHome |
| 43 | + !insertmacro _RemoveDirIfExists "$NtTempPath\.nodetool" |
| 44 | + doneUserHome: |
| 45 | +!macroend |
0 commit comments