Skip to content

Keep a Windows drive letter when joining a root-relative path - #1009

Open
hamed75kazemii wants to merge 1 commit into
dart-lang:mainfrom
hamed75kazemii:fix-windows-join-drive
Open

hamed75kazemii wants to merge 1 commit into
dart-lang:mainfrom
hamed75kazemii:fix-windows-join-drive

Conversation

@hamed75kazemii

Copy link
Copy Markdown

Summary

  • join('C:', r'\Users\name') returned \Users\name. C: is not an absolute root, so the following root-relative part replaced the whole buffer.
  • A part that is only a drive letter is now kept, which matches joining HOMEDRIVE with HOMEPATH.
  • Joining onto a real absolute path such as c:\b still replaces the tail, and a root-relative part still discards earlier relative parts.

Fixes #512

Test plan

  • join('C:', r'\Users\danny') is C:\Users\danny
  • join('c:', r'\Users\danny', 'docs') is c:\Users\danny\docs
  • join('a', r'\b', r'\c', 'd') is still \c\d
  • join('a', r'c:\b', r'\c', 'd') is still c:\c\d

Made with Cursor

join("C:", "\Users\name") dropped the drive because "C:" is not an absolute root and the following part replaced the buffer.

Fixes dart-lang#512

Co-authored-by: Cursor <cursoragent@cursor.com>
@hamed75kazemii
hamed75kazemii requested a review from a team as a code owner October 10, 2026 19:34
@google-cla

google-cla Bot commented Oct 10, 2026

Copy link
Copy Markdown

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Segments that are just a drive letter are dropped on Windows

1 participant