-
-
Notifications
You must be signed in to change notification settings - Fork 233
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix handling of Windows absolute paths. #315
Conversation
Kind of wondering, why is this library doing all this weird stuff with checking for windows and manual path fixing when there's available libraries that do this all for us? For example, node's in-built path library |
Hi please merge this if possible |
@jonluca anything preventing this from being merged? |
Yeah I agree - I think I'd prefer to just go through and fix all these issues directly. Will take a look right now, and if I don't see a fast way of fixing it I'll merge in this PR. |
* @returns | ||
*/ | ||
export function isWindows() { | ||
return /^win/.test(globalThis.process ? globalThis.process.platform : ""); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is there a reason this is a function now, and not a constant? globalThis.process should never change during runtime?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ah for the test, I see
Thanks for the PR - I'm going to release a breaking change soon with changes that should fix what this is targeting. In general I think we should revamp the windows logic, like @meepen said. |
This should fix #311
Added handling for absolute Windows file paths.
Added some additional tests around the url.fromFileSystemPath() to help catch this error in the future as no existing test was failing.