Skip to content

Parse Windows-style paths when path.parse is posix - #10

Open
dyk1454683243-sudo wants to merge 2 commits into
jonschlinkert:masterfrom
dyk1454683243-sudo:cursor/fix-windows-path-parse-e188
Open

dyk1454683243-sudo wants to merge 2 commits into
jonschlinkert:masterfrom
dyk1454683243-sudo:cursor/fix-windows-path-parse-e188

Conversation

@dyk1454683243-sudo

Copy link
Copy Markdown

Fixes #9

Problem

When Node's path.parse is the posix implementation, Windows paths that use backslashes (and drive-letter / UNC forms) are treated as a single filename. That yields an empty dirname, a full-path basename/name, and isAbsolute: false.

Example: C:\Program Files\Projects\Example\launchFile.exe

Solution

Detect Windows-style paths (drive letter ^[A-Za-z]:[\\/], UNC \\server\share, or backslash separators) and parse them with path.win32.parse. Ordinary posix paths keep the existing path.parse behavior.

isAbsolute uses win32 rules for those paths so a drive or UNC path is absolute on non-Windows hosts as well.

Existing aliases (extname, basename, dirname, stem) are unchanged.

Tests

cursoragent and others added 2 commits September 20, 2026 19:07
Reproduce the issue when path.parse is posix: drive-letter paths
with backslashes should use win32 semantics, while posix paths stay
unchanged.

Co-authored-by: David <dyk1454683243-sudo@users.noreply.github.com>
When path.parse is posix, drive-letter, UNC, and backslash paths were
treated as a single filename. Detect those inputs and parse them with
path.win32 so dirname/basename/name and isAbsolute match win32 semantics.

Co-authored-by: David <dyk1454683243-sudo@users.noreply.github.com>
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.

Not parsing windows path separators correctly

2 participants