marijnh / Eloquent-JavaScript

The sources for the Eloquent JavaScript book
https://eloquentjavascript.net
3.01k stars 793 forks source link

Ch 20, urlPath function - separator misbehaviour on Windows #446

Closed HattyJetty closed 6 years ago

HattyJetty commented 6 years ago

https://eloquentjavascript.net/20_node.html#c_LMKrGVrGZP Here on line 10 the expression !path.startsWith(baseDirectory + "/") might result in the wrong value, because the separator difference on Windows is not taken into account.

I guess this can be avoided by concatenating with the sep from path module.

marijnh commented 6 years ago

Thanks for pointing that out. Attached patch updates the code to use sep