preserve legacy portable marker during updates (#1167)

This commit is contained in:
Fero 2026-03-31 00:53:57 +02:00 committed by GitHub
parent d1d3393230
commit 552ebe5378
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -587,17 +587,21 @@ Function .onInit
; --- PORTABLE MODE --- Auto-detect portable mode during updates.
; If the target directory already has a valid portable marker file, preserve
; portable mode so the Tauri updater works without needing /PORTABLE.
; We validate the magic string to avoid false-positives from stale empty files
; left by scoop's NSIS extraction (dl.7z side-effect).
; Preserve portable installs that use either the current magic-string marker
; or the legacy empty marker created by older Handy releases. Require Data/
; for the legacy empty-marker case so stale scoop side-effect files do not
; accidentally opt an updater run into portable mode.
${If} $PortableMode <> 1
${AndIf} $UpdateMode = 1
${AndIf} ${FileExists} "$INSTDIR\portable"
FileOpen $1 "$INSTDIR\portable" r
FileRead $1 $2
FileClose $1
${If} $2 == "Handy Portable Mode"
StrCpy $PortableMode 1
${OrIf} $2 == ""
${AndIf} ${FileExists} "$INSTDIR\Data"
StrCpy $PortableMode 1
${EndIf}
${EndIf}