Fix: Windows installer now deletes files and cleans up PATH environment var#3066
Fix: Windows installer now deletes files and cleans up PATH environment var#3066mwinkel-dev wants to merge 5 commits into
Conversation
|
The installation instructions in ReadTheDocs should mention the silent installation commands. These commands are useful when sysadmins are writing scripts to install MDSplus.
|
|
Retest this please |
|
What if a user installs it to |
|
In that ;case, the uninstaller does unregister MDSplus. But the user will have to manually delete the The above policy is of course a compromise.
The only robust solution is to generate a log file during installation of all files that were installed. Then the uninstaller only deletes files that are listed in that log. There are Nullsoft users that have posted macros that do that, but it would add a lot of code to our installer. (Note that prior to the CMake PR 2527, that MDSplus was being installed in system directories and the installer did have code to create a log file. But that code was rendered obsolete by PR 2527, which is one of the reasons the uninstaller stopped working. For the details, refer to the commented code in the first commit of this PR.) |
|
There is an alternate approach for dealing with non-standard installation directories (such as
The above approach isn't as robust as using a log of installed files to drive the uninstaller. However, the above approach is more flexible than the compromise taken with this PR. |
|
VSCode has an NSIS extension that is nice. The extension allows collapsing code blocks (macros, functions, if clauses, etcetera), thus makes it much easier to understand the overall architecture of the installer. Plus, it has all the other usual features: keywords in color, keyword completion and so forth. Perhaps the |
|
Here are some macros that manage NSIS uninstall lists.
Another possibility is to write a custom solution (i.e., something similar to what the MDSplus installer had in the past). If we decide to use a log file to drive the uninstaller, my preference is to use a third-party solution if any are suitable. To be suitable, it needs to be widely used, maintained, full-featured, robust and not be quarantined by Windows Defender. If none of the available third-party solutions meet those criteria, then as a contingency plan we should write a custom solution tailored to our needs. |
WhoBrokeTheBuild
left a comment
There was a problem hiding this comment.
Overall looks good to me, however I do think we should use an explicit list of files during uninstall if possible. If not, then I'll approve this PR. Great work!
| Var /GLOBAL InstBaseName | ||
| ${GetBaseName} $INSTDIR $InstBaseName | ||
| ${IfNot} "$InstBaseName" == ${MULTIUSER_INSTALLMODE_INSTDIR} | ||
| ${ToLog} "Non-standard dir, so MDPlus was unregistered but not deleted." |
| ; MessageBox MB_OKCANCEL "Non-standard dir, so MDPlus was unregistered but not deleted." /SD IDOK IDOK next | ||
| IfSilent next gui ; Note that ${IfSilent} is not available in NSIS v3.09 | ||
| gui: | ||
| MessageBox MB_OK "Non-standard dir, so MDPlus was unregistered but not deleted." IDOK next |
This fixes Issue #3063.
recycle.nshwas broken, so removed it.C:\Program Files\MDSplusbut made a typo and instead installed toC:\Program Filesdon't want to do deletion because it would clobber all programs installed on the computer. Now, deletion only occurs if the directory's path ends inMDSplus.)