From cfb498596c19b74727cad11d305bcf056cca5c76 Mon Sep 17 00:00:00 2001 From: Miguel Allende Date: Thu, 29 Jan 2026 10:43:52 +0100 Subject: [PATCH 1/2] Update plugin installation and uninstallation paths to use the correct directory --- docker-compose/tools/chocolateyInstall.ps1 | 15 ++++++++++++++- docker-compose/tools/chocolateyUninstall.ps1 | 2 +- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/docker-compose/tools/chocolateyInstall.ps1 b/docker-compose/tools/chocolateyInstall.ps1 index 224e89a..5656e12 100644 --- a/docker-compose/tools/chocolateyInstall.ps1 +++ b/docker-compose/tools/chocolateyInstall.ps1 @@ -2,7 +2,7 @@ $packageToolsDir = "$(Split-Path -Parent $MyInvocation.MyCommand.Definition)" $executablePath = Join-Path $packageToolsDir 'docker-compose.exe' -$executableTargetDir = 'C:\ProgramData\Docker\cli-plugins\' +$executableTargetDir = 'C:\Program Files\Docker\cli-plugins\' $executableTargetPath = Join-Path $executableTargetDir 'docker-compose.exe' # create plugin directory if it doesn't exist @@ -13,5 +13,18 @@ if (-not (Test-Path -Path $executableTargetDir)) { # remove docker-compose shim if it still exists Uninstall-BinFile -name docker-compose -ErrorAction:Ignore +# clean up old installation location (backward compatibility) +$oldExecutableDir = 'C:\ProgramData\Docker\cli-plugins\' +$oldExecutablePath = Join-Path $oldExecutableDir 'docker-compose.exe' +if (Test-Path -Path $oldExecutablePath) { + Remove-Item -Path $oldExecutablePath -Force + # remove old directory if empty + if (Test-Path -Path $oldExecutableDir) { + if ($null -eq (Get-ChildItem -Path $oldExecutableDir)) { + Remove-Item -Path $oldExecutableDir -Force + } + } +} + # move executable Move-Item -Path $executablePath -Destination $executableTargetPath -Force diff --git a/docker-compose/tools/chocolateyUninstall.ps1 b/docker-compose/tools/chocolateyUninstall.ps1 index b0f10ec..50baace 100644 --- a/docker-compose/tools/chocolateyUninstall.ps1 +++ b/docker-compose/tools/chocolateyUninstall.ps1 @@ -1,5 +1,5 @@ $ErrorActionPreference = "Stop" -$executableDir = 'C:\ProgramData\Docker\cli-plugins\' +$executableDir = 'C:\Program Files\Docker\cli-plugins\' $executablePath = Join-Path $executableDir 'docker-compose.exe' $dockerPath = Split-Path -Path $executableDir -Parent From 08158b0c02fe016fcc48f12e9e375d41d6d2e559 Mon Sep 17 00:00:00 2001 From: Miguel Allende Date: Fri, 30 Jan 2026 11:06:14 +0100 Subject: [PATCH 2/2] Remove deprecated paths when installing --- docker-compose/tools/chocolateyInstall.ps1 | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/docker-compose/tools/chocolateyInstall.ps1 b/docker-compose/tools/chocolateyInstall.ps1 index 5656e12..a8ad279 100644 --- a/docker-compose/tools/chocolateyInstall.ps1 +++ b/docker-compose/tools/chocolateyInstall.ps1 @@ -16,13 +16,23 @@ Uninstall-BinFile -name docker-compose -ErrorAction:Ignore # clean up old installation location (backward compatibility) $oldExecutableDir = 'C:\ProgramData\Docker\cli-plugins\' $oldExecutablePath = Join-Path $oldExecutableDir 'docker-compose.exe' +$oldDockerPath = Split-Path -Path $oldExecutableDir -Parent + if (Test-Path -Path $oldExecutablePath) { Remove-Item -Path $oldExecutablePath -Force - # remove old directory if empty - if (Test-Path -Path $oldExecutableDir) { - if ($null -eq (Get-ChildItem -Path $oldExecutableDir)) { - Remove-Item -Path $oldExecutableDir -Force - } +} + +# remove old plugin directory if empty +if (Test-Path -Path $oldExecutableDir) { + if ($null -eq (Get-ChildItem -Path $oldExecutableDir)) { + Remove-Item -Path $oldExecutableDir -Force + } +} + +# remove old docker directory if empty +if (Test-Path -Path $oldDockerPath) { + if ($null -eq (Get-ChildItem -Path $oldDockerPath)) { + Remove-Item -Path $oldDockerPath -Force } }