Skip to content

Fix Windows path resolution causing duplicate drive letter#3

Open
robwent wants to merge 1 commit intovelohost:mainfrom
robwent:fix/windows-path-resolution
Open

Fix Windows path resolution causing duplicate drive letter#3
robwent wants to merge 1 commit intovelohost:mainfrom
robwent:fix/windows-path-resolution

Conversation

@robwent
Copy link
Copy Markdown

@robwent robwent commented Mar 28, 2026

On Windows, new URL(dir).pathname returns /C:/path/to/dist/ which gets prepended with the cwd by readdirSync, producing an invalid path like C:\C:\path\to\dist\.

Use fileURLToPath() instead, which correctly converts file:// URLs to platform-appropriate paths on both Windows and Linux.

Fixes #2

On Windows, `new URL(dir).pathname` returns `/C:/path/to/dist/` which gets prepended with the cwd by `readdirSync`, producing an invalid path like `C:\C:\path\to\dist\`.

Use `fileURLToPath()` instead, which correctly converts file:// URLs to platform-appropriate paths on both Windows and Linux.

Fixes velohost#2
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.

Windows: Duplicate drive reference causes "no such file or directory"

1 participant