Describe the suggested improvement
The current installer logic deletes folder content with some exclusions and adds files from the new version into the instance folder.
Various things can happen here like file locks because files are in use due to a hanging instance, a virus scanner, or because a user has a file open in an editor.
The following mitigates the file in uses issue during upgrades:
However, the installer logic itself is flawed and it should not "destroy" the current installation until it completed its update. The installer logic could benefit from the following flow:
- Move "current" folder to "old" to minimize file in use / locking issues
- Prep "new" folder with "new" version and copy some old files
- Move new to current
- Delete old
If an error occurs during:
- 1: old/current version unaffected
- 2 or 3: old unaffected and we move back "old" to "current"
- 4: new instance already ready for start
The installer could be a bit smarter and probe "old", "new" folders to suggest cleanup if these paths exists.
Alternatives
- Do not just remove old instances but keep them on the file system
- Include version info in file path for installed instances