Skip to content

fix(updater): use robocopy mirror on Windows to remove obsolete DLLs and assets during in-place updates #1377

Description

@ZhuchkaTriplesix

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:

  1. 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.
  2. Windows DLL search order can lead to stale binary loading, symbol mismatch crashes, or corrupted asset bundles after an in-place update.
  3. 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.

Activity

  1. added
    bugSomething isn't working
    stabilityTheme parser epic label: stability
    coreCore library logic and services
    P2Medium priority / Parity & Refactoring
    on Oct 10, 2026
  2. ZhuchkaTriplesix commented on Oct 11, 2026

    @ZhuchkaTriplesix
    MemberAuthor

    Done in #1383 (merged into dev).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Medium priority / Parity & RefactoringbugSomething isn't workingcoreCore library logic and servicesstabilityTheme parser epic label: stability

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions