8000 Change `Target` from a `CodeProperty` to be an `AliasProperty` that points to `FileSystemInfo.LinkTarget` by daxian-dbw · Pull Request #16165 · PowerShell/PowerShell · GitHub
[go: up one dir, main page]

Skip to content

Conversation

@daxian-dbw
Copy link
Member
@daxian-dbw daxian-dbw commented Sep 28, 2021

PR Summary

Fix #15958
Fix #13365

Change Target from a CodeProperty to be an AliasProperty that points to FileSystemInfo.LinkTarget.
Also, keep the public API InternalSymbolicLinkLinkCodeMethods.GetTarget(PSObject instance), but use FileSystemInfo.LinkTarget inside.

I have reviewed the .NET implementation of LinkTarget, and can confirm that the functionality is in parity.
The only difference is that LinkTarget doesn't throw error when the file doesn't exist, but our GetTarget(...) throws exception in that case. So, I add the file-existence check at some places, and other places doesn't need the check.

It would be easier to review by ignoring the white-space changes:
https://github.com/PowerShell/PowerShell/pull/16165/files?w=1

PR Context

PR Checklist

@ghost ghost assigned rjmholt Sep 28, 2021
Copy link
Collaborator
@iSazonov iSazonov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@daxian-dbw Since you refactor the code why not remove Platform.IsWindows() and put code under #if?

@daxian-dbw
Copy link
Member Author

Since you refactor the code why not remove Platform.IsWindows() and put code under #if?

@iSazonov That's not a goal of this PR :)

@daxian-dbw
Copy link
Member Author

@iSazonov I made some updates based on your comments. Please take another look when you have time, thanks!

@rjmholt rjmholt merged commit 2f57bf8 into PowerShell:master Oct 5, 2021
@daxian-dbw daxian-dbw deleted the target branch October 5, 2021 18:30
@daxian-dbw daxian-dbw added the CL-General Indicates that a PR should be marked as a general cmdlet change in the Change Log label Oct 5, 2021
daxian-dbw added a commit to daxian-dbw/PowerShell that referenced this pull request Oct 21, 2021
@ghost
Copy link
ghost commented Oct 21, 2021

🎉v7.2.0-rc.1 has been released which incorporates this pull request.:tada:

Handy links:

@ghost
Copy link
ghost commented Dec 16, 2021

🎉v7.3.0-preview.1 has been released which incorporates this pull request.:tada:

Handy links:

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

Labels

Backport-7.2.x-Done CL-General Indicates that a PR should be marked as a general cmdlet change in the Change Log

Projects

None yet

4 participants

0