fix(desktop): remember the install path across Windows updates#3060
Open
HUQIANTAO wants to merge 1 commit into
Open
fix(desktop): remember the install path across Windows updates#3060HUQIANTAO wants to merge 1 commit into
HUQIANTAO wants to merge 1 commit into
Conversation
Closes esengine#3031 The Windows installer hard-coded `InstallDir$LOCALAPPDATA\Programs\`. On update (silent /S from the auto-updater, or interactive) the user was forced back to the per-user default even if they had moved the install to a different drive (e.g. `D:\Tools\Reasonix`). The auto-updater in particular would re-run with /S into the wrong dir and leave the previous install orphaned at the original path. This change: * Switches the installer to `InstallDirRegKey HKCU ${UNINST_KEY} "InstallLocation"` so the next install inherits the previous path. * Falls back to the per-user default in `.onInit` when the value is missing (first install, uninstaller registry wiped, or the value is empty). * Persists the resolved path to `InstallLocation` on every install, so the silent auto-updater can find it next time. * The persisted value is written *before* the GetSize block so the registry is always consistent with the installed files.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The Windows installer hard-coded
InstallDir $LOCALAPPDATA\Programs\Reasonix. On update (silent/Sfrom the auto-updater, or interactive) the user was forced back to the per-user default even if they had moved the install to a different drive. The silent auto-updater would re-run with/Sinto the wrong dir and leave the previous install orphaned.Problem
The auto-updater downloads a fresh installer and re-runs it with
/S. NSIS's defaultInstallDiris the literal$LOCALAPPDATA\Programs\Reasonix, so the silent install lands there even if the previous install was atD:\Tools\Reasonix. The user-visible effect: updates don't replace the binary the user launched from, the launcher/shortcut stops pointing at the active install, and the old dir is orphaned (and grows with every update).Changes
InstallDirRegKey HKCU ${UNINST_KEY} "InstallLocation"so the next install inherits the previous path..onInitwhen the value is missing (first install, uninstaller registry wiped, or the value is empty).InstallLocationon every install, so the silent auto-updater can find it next time.Test plan
makensisparses the file (CI does this on the build script).D:\Tools\Reasonix, run the installer again → it lands atD:\Tools\Reasonix. Wipe the uninstaller registry, run the installer again → it falls back to the per-user default.