winget-cli icon indicating copy to clipboard operation
winget-cli copied to clipboard

Use copy instead of rename for moving extracted archive directories

Open ryfu-msft opened this issue 2 years ago • 0 comments

Fixes #2931

Special thanks to @farag2 for the extremely thorough investigation on this one. 😄

Issue: When specifying a specific --location that points to a different drive, the installation fails with an access denied error. The issue is caused when trying to rename a directory across a different drive which isn't supported as rename is not a "move/copy" operation. The correct way to handle moving directories is to explicitly copy the directory recursively over to the intended install location.

Changes: Replaced Rename with Copy operation for directory file types during archiveinstallation.

Tests: Verified that the following command identified from the issue bug successfully installed. All existing tests should continue to pass. winget install --id=TeamSophia.SophiApp --exact --accept-source-agreements --location "D:\test"

Microsoft Reviewers: Open in CodeFlow

ryfu-msft avatar Feb 22 '23 19:02 ryfu-msft