yortus / require-self

Lets you require('foobar') from within foobar itself
MIT License
19 stars 5 forks source link

Escape cwd so that it works for Windows as well #10

Closed AviVahl closed 7 years ago

AviVahl commented 7 years ago

On windows, cwd contains the character \, so it must be escaped to \\ for the path to work in a string.

before change: module.exports = require('C:\projects\my-project');

after change: module.exports = require('C:\\projects\\my-project');

change should not affect non-Windows platforms. as they use / as path separator.

yortus commented 7 years ago

Thanks @AviVahl!

AviVahl commented 7 years ago

@yortus thx for merging! If possible, could you please publish it as a quick bug-fix release? We use your package and it's currently broken on Windows machines...

yortus commented 7 years ago

Published v0.2.1