Skip to content

Write file reference with correct capitalisation#8890

Merged
drewnoakes merged 1 commit intodotnet:mainfrom
drewnoakes:resx-linked-file-path-capitalization
Mar 2, 2023
Merged

Write file reference with correct capitalisation#8890
drewnoakes merged 1 commit intodotnet:mainfrom
drewnoakes:resx-linked-file-path-capitalization

Conversation

@drewnoakes
Copy link
Copy Markdown
Member

@drewnoakes drewnoakes commented Mar 2, 2023

Fixes AB#1757141

When dragging a file from Solution Explorer into the Managed Resources editor, the file path is written to the .resx file in lower case.

This is because the "drop data" provided by Solution Explorer contains a lower-case path (both for SDK-style and legacy projects).

To fix this, we walk the path, using Path.EnumerateFileSystemEntries to produce a correctly cased path for the file being dragged. Unfortunately there's no better way I could find to achieve this. I tried quite a few different approaches and this seemed like the least rubbish. The approach used in GetFileNameInActualCase elsewhere in the resource editor only handles the file name, not any directories above it.


This issue has been reported in various feedback tickets and has attracted a significant amount of attention/votes.

Microsoft Reviewers: Open in CodeFlow

When dragging a file from Solution Explorer into the Managed Resources editor, the file path is written to the `.resx` file in lower case.

This is because the "drop data" provided by Solution Explorer contains a lower-case path (both for SDK-style and legacy projects).

To fix this, we walk the path, using `Path.EnumerateFileSystemEntries` to produce a correctly cased path for the file being dragged. Unfortunately there's no better way I could find to achieve this. I tried quite a few different approaches and this seemed like the least rubbish. The approach used in `GetFileNameInActualCase` elsewhere in the resource editor only handles the file name, not any directories above it.
@drewnoakes drewnoakes added the Feature-Resource-Designer DEPRECATED The legacy resource file (RESX) editor. label Mar 2, 2023
@drewnoakes drewnoakes added this to the 17.6 milestone Mar 2, 2023
@drewnoakes drewnoakes requested a review from a team as a code owner March 2, 2023 03:04
Copy link
Copy Markdown
Member

@MiYanni MiYanni left a comment

Choose a reason for hiding this comment

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

I did some research after seeing this PR, and it does seem like an annoying situation to resolve. I believe this solution to be completely reasonable.

@drewnoakes drewnoakes merged commit acda127 into dotnet:main Mar 2, 2023
@drewnoakes drewnoakes deleted the resx-linked-file-path-capitalization branch March 2, 2023 21:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Feature-Resource-Designer DEPRECATED The legacy resource file (RESX) editor.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants