Skip to content

Remove duplicate function in FileUtilities.cs#13248

Merged
AR-May merged 1 commit intodotnet:mainfrom
AR-May:refactor-file-utilities-2
Feb 16, 2026
Merged

Remove duplicate function in FileUtilities.cs#13248
AR-May merged 1 commit intodotnet:mainfrom
AR-May:refactor-file-utilities-2

Conversation

@AR-May
Copy link
Copy Markdown
Member

@AR-May AR-May commented Feb 12, 2026

Context

RemoveRelativeSegments does the same as AbsolutePath.GetCanonicalForm(). There is no need for code duplication.

Testing

Unit tests

Copilot AI review requested due to automatic review settings February 12, 2026 14:48
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Removes duplicated path-canonicalization logic by dropping FrameworkFileUtilities.RemoveRelativeSegments and switching call sites to the existing AbsolutePath.GetCanonicalForm() implementation in the Framework.

Changes:

  • Updated Copy.PathsAreIdentical to canonicalize via AbsolutePath.GetCanonicalForm() instead of FrameworkFileUtilities.RemoveRelativeSegments.
  • Removed the now-redundant FrameworkFileUtilities.RemoveRelativeSegments method from FileUtilities.cs.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
src/Tasks/Copy.cs Uses AbsolutePath.GetCanonicalForm() for path canonicalization prior to comparison.
src/Framework/FileUtilities.cs Removes duplicated canonicalization helper (RemoveRelativeSegments).

@AR-May AR-May self-assigned this Feb 16, 2026
@AR-May AR-May merged commit 81815e5 into dotnet:main Feb 16, 2026
16 checks passed
Copilot AI pushed a commit that referenced this pull request Feb 17, 2026
### Context
`RemoveRelativeSegments` does the same as `AbsolutePath.GetCanonicalForm()`. There is no need for code duplication.

### Testing
Unit tests
JanProvaznik pushed a commit to JanProvaznik/msbuild that referenced this pull request Feb 25, 2026
### Context
`RemoveRelativeSegments` does the same as `AbsolutePath.GetCanonicalForm()`. There is no need for code duplication.

### Testing
Unit tests
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.

3 participants