Use copy instead of rename for moving extracted archive directories #3003
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 asrename
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
withCopy
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