Skip to content

Clarify MatchCasing does not affect directory path resolution#126185

Open
rtmongold wants to merge 5 commits intodotnet:mainfrom
rtmongold:fix-matchcasing-docs
Open

Clarify MatchCasing does not affect directory path resolution#126185
rtmongold wants to merge 5 commits intodotnet:mainfrom
rtmongold:fix-matchcasing-docs

Conversation

@rtmongold
Copy link
Copy Markdown

Closes #115356

Summary

This PR clarifies that EnumerationOptions.MatchCasing applies only to file name pattern matching and does not affect directory path resolution.

On case-sensitive file systems (e.g., Linux and macOS), directory paths must match the exact casing even if MatchCasing = CaseInsensitive.

Motivation

Users may assume that MatchCasing affects the full path when performing searches. In reality, it only applies to file name pattern matching, which can be misleading on case-sensitive systems. This update improves documentation to reduce confusion.

Changes

  • Updated XML doc comment in EnumerationOptions.cs (runtime repo)
  • Updated API XML (EnumerationOptions.xml) with <remarks> clarifying:
    • Scope is limited to file name matching
    • Directory paths are unaffected
    • Default behavior is platform-dependent
  • Optional example included in API XML to illustrate Linux behavior

Example (API docs)

Directory.GetFiles("/tmp/data", "*.TXT",
    new EnumerationOptions { MatchCasing = MatchCasing.CaseInsensitive });

Copy link
Copy Markdown
Author

@rtmongold rtmongold left a comment

Choose a reason for hiding this comment

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

Changed the tab to spaces.

@rtmongold rtmongold force-pushed the fix-matchcasing-docs branch 3 times, most recently from 3d562c0 to a62ef2d Compare March 27, 2026 17:41
@rtmongold
Copy link
Copy Markdown
Author

This is a docs-only PR. The branch appears to go out of date frequently due to ongoing commits in main.

I’ve rebased to the latest main—happy to rebase again if needed, but it may require a maintainer rebase at merge time.

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

This PR updates the EnumerationOptions.MatchCasing API documentation to clarify that it affects only name matching against the search pattern and does not change how directory paths are resolved on case-sensitive file systems.

Changes:

  • Updated the XML doc comment for EnumerationOptions.MatchCasing to scope it to pattern matching.
  • Added remarks stating directory path resolution is unaffected, and casing must still match on case-sensitive file systems.

@rtmongold rtmongold force-pushed the fix-matchcasing-docs branch from da57c3b to d857acd Compare March 29, 2026 03:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area-System.IO community-contribution Indicates that the PR has been added by a community member

Projects

None yet

Development

Successfully merging this pull request may close these issues.

System.IO.EnumerationOptions.MatchCasing is potentially misleading

2 participants