Skip to content

Fix accidental VMApp removal when extension update fails. Also migrate VMApp download directory on extension update.#83

Open
D1v38om83r wants to merge 12 commits intomasterfrom
dev/bhbrahma/fix-updates
Open

Fix accidental VMApp removal when extension update fails. Also migrate VMApp download directory on extension update.#83
D1v38om83r wants to merge 12 commits intomasterfrom
dev/bhbrahma/fix-updates

Conversation

@D1v38om83r
Copy link
Copy Markdown
Collaborator

@D1v38om83r D1v38om83r commented Apr 3, 2026

Summary

  • removed the "uninstall all VMApp behavior" or VMApp extension uninstall
  • made the extension update callback method more robust
    • previously, it searched for its own extension version in the configuration folder path, now it uses a version pattern
  • added additional behavior to also copy the download directory and all its subfolders to the download directory of the new extension version
  • update the package registry file with the new download directory path
  • made the extension version a mandatory parameter for both MAKEFILE and makefile.win, this will ensure that the correct value for compile time variable ExtensionVersion is set when it is published

Changes

  • main/main.go

    • Removed vmAppUninstallCallback and doVmAppUninstallCallback functions
    • Set ii.UninstallCallback = nil — no special handling needed on uninstall
  • main/main_test.go

    • Removed 4 uninstall tests
  • main/update_windows.go

    • ModifiedfindVersionDir to walk up the directory tree using filepath.Dir root detection instead of a magic-number loop limit
    • Replaced strings.Contains(name, ExtensionVersion) with regex-based utils.IsValidVersionString for version directory detection
    • Added moveDownloadDirToCurrentVersion — copies download subdirectories from older versions to the current version using robocopy
    • Added updateDonwnloadDirInPackageRegistryFile — uses regex replacement to update the extension version segment in each package's DownloadDir path
    • Added copySubdirectoryUsingRobocopy — wrapper around robocopy with proper exit code handling
    • Both new operations are best-effort with warning-level logging on failure
  • pkg/utils/versionstringutils.go

    • Added IsValidVersionString function using regex ^[0-9]+(\.[0-9]+){2,4}$
    • Updated versionStringPattern to require at least 3 version segments
  • main/update_windows_test.go

    • Added 9 new tests covering download directory migration, registry path updates, edge cases (no packages, no older versions, non-version directories), and a full end-to-end test

@D1v38om83r D1v38om83r changed the title Migrate download directories during Windows extension updates Fix accidental VMApp removal when extension update fails. Also migrate VMApp download directory on extension update. Apr 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants