Problem
In lib/core/updater/installers/update_install_utils.dart (buildWindowsReplaceBatch), the generated Windows batch script executes:
xcopy /E /Y /I "%SRC%\\*" "%DST%\\"
Unlike Linux (buildLinuxBundleReplaceScript), which uses rsync -a --delete --exclude='QueryaData' --exclude='.portable' to clean up deleted/renamed files, xcopy is purely additive:
- Renamed, replaced, or deleted DLLs (e.g. Flutter engine upgrades, native plugin binaries, ICU data files) from the previous installation remain indefinitely in the application directory.
- Windows DLL search order can lead to stale binary loading, symbol mismatch crashes, or corrupted asset bundles after an in-place update.
- Portable mode directories (
QueryaData, .portable) are not explicitly protected from being overwritten if the archive contains default assets matching those paths.
Solution
Replace xcopy in buildWindowsReplaceBatch with robocopy /MIR:
robocopy "%SRC%" "%DST%" /MIR /XD "QueryaData" /XF ".portable" /R:2 /W:1
if %ERRORLEVEL% GEQ 8 (
echo Update failed with error %ERRORLEVEL%
exit /b %ERRORLEVEL%
)
start "" "%EXE%"
del "%~f0"
/MIR synchronizes and removes files in the destination that no longer exist in the new release bundle.
/XD "QueryaData" and /XF ".portable" preserve portable configuration and user data across updates.
robocopy returns exit codes 0–7 on successful synchronization (e.g. 1 = files copied, 2 = extra files removed). Only exit codes >= 8 indicate fatal errors.
Problem
In
lib/core/updater/installers/update_install_utils.dart(buildWindowsReplaceBatch), the generated Windows batch script executes:Unlike Linux (
buildLinuxBundleReplaceScript), which usesrsync -a --delete --exclude='QueryaData' --exclude='.portable'to clean up deleted/renamed files,xcopyis purely additive:QueryaData,.portable) are not explicitly protected from being overwritten if the archive contains default assets matching those paths.Solution
Replace
xcopyinbuildWindowsReplaceBatchwithrobocopy /MIR:/MIRsynchronizes and removes files in the destination that no longer exist in the new release bundle./XD "QueryaData"and/XF ".portable"preserve portable configuration and user data across updates.robocopyreturns exit codes 0–7 on successful synchronization (e.g. 1 = files copied, 2 = extra files removed). Only exit codes >= 8 indicate fatal errors.