This repository has been archived by the owner on Jan 13, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1k
Path separators issue in fs.readdir #172
Comments
I dug into this a little bit more and wrote a small hack that is working for me. It's just a workaround for now since I don't have the time to figure out the right way to do this and make a proper PR, but here's the change I made. Hopefully this will help someone fix it the right way. In fs.readdir = function (path) {
var isRoot = isRootPath(path);
// <hack>
if (windows) arguments[0] = path = path.replace(/\//g, '\\');
// </hack>
if (!insideSnapshot(path) && !isRoot) {
return ancestor.readdir.apply(fs, arguments);
}
if (insideMountpoint(path)) {
return ancestor.readdir.apply(fs, translateNth(arguments, 0, path));
}
var callback = dezalgo(maybeCallback(arguments));
readdirFromSnapshot(path, isRoot, callback);
}; And I copied the same line to I'm hoping a fix for this can make it into the next version because I'm running this in CI and can't easily include my hack there. If I can be of anymore help please let me know. Thanks! |
Thanks! Going to fix now |
xdevs23
pushed a commit
to xdevs23/pkg
that referenced
this issue
Jul 26, 2017
Fixed in |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
I've been trying to get a Next.js project working with pkg and I've finally tracked down the issue to
fs.readdir
being called inglob
.On Windows locally each of these works:
fs.readdirSync('C:\\somedir')
andfs.readdirSync('C:/somedir')
But in my pkg Windows executable the second of these fails:
fs.readdirSync('C:\\snapshot')
andfs.readdirSync('C:/snapshot')
I receive this error message:
Error: ENOENT: no such file or directory, scandir 'C:\snapshot'
The text was updated successfully, but these errors were encountered: