We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
getDirent().parentPath
UV_DIRENT_UNKNOWN
1 parent 2933866 commit c91ce21Copy full SHA for c91ce21
2 files changed
lib/internal/fs/utils.js
@@ -301,7 +301,7 @@ function getDirent(path, name, type, callback) {
301
callback(err);
302
return;
303
}
304
- callback(null, new DirentFromStats(name, stats, filepath));
+ callback(null, new DirentFromStats(name, stats, path));
305
});
306
} else {
307
callback(null, new Dirent(name, type, path));
test/parallel/test-fs-utils-get-dirents.js
@@ -75,6 +75,7 @@ const filename = 'foo';
75
common.mustCall((err, dirent) => {
76
assert.strictEqual(err, null);
77
assert.strictEqual(dirent.name, filename);
78
+ assert.strictEqual(dirent.parentPath, tmpdir.path);
79
},
80
));
81
@@ -100,20 +101,22 @@ const filename = 'foo';
100
101
102
103
assert.strictEqual(dirent.name, filenameBuffer);
- assert.deepStrictEqual(dirent.parentPath, Buffer.from(tmpdir.resolve(`${filename}/`)));
104
105
106
107
108
{
109
// Buffer + Buffer
110
const filenameBuffer = Buffer.from(filename);
111
+ const dirnameBuffer = Buffer.from(tmpdir.path);
112
getDirent(
- Buffer.from(tmpdir.path),
113
+ dirnameBuffer,
114
filenameBuffer,
115
UV_DIRENT_UNKNOWN,
116
117
118
119
+ assert.deepStrictEqual(dirent.parentPath, dirnameBuffer);
120
121
122
0 commit comments