mirror of
https://github.com/nodejs/node.git
synced 2024-11-21 10:59:27 +00:00
fs: move ToNamespacedPath
dir calls to c++
PR-URL: https://github.com/nodejs/node/pull/53630 Reviewed-By: Vinícius Lourenço Claro Cardoso <contact@viniciusl.com.br> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Stephen Belanger <admin@stephenbelanger.com>
This commit is contained in:
parent
05bb4a716b
commit
3ad2e12073
@ -155,7 +155,7 @@ class Dir {
|
||||
readSyncRecursive(dirent) {
|
||||
const path = pathModule.join(dirent.parentPath, dirent.name);
|
||||
const handle = dirBinding.opendir(
|
||||
pathModule.toNamespacedPath(path),
|
||||
path,
|
||||
this.#options.encoding,
|
||||
);
|
||||
|
||||
@ -298,7 +298,7 @@ function opendir(path, options, callback) {
|
||||
req.oncomplete = opendirCallback;
|
||||
|
||||
dirBinding.opendir(
|
||||
pathModule.toNamespacedPath(path),
|
||||
path,
|
||||
options.encoding,
|
||||
req,
|
||||
);
|
||||
@ -308,9 +308,7 @@ function opendirSync(path, options) {
|
||||
path = getValidatedPath(path);
|
||||
options = getOptions(options, { encoding: 'utf8' });
|
||||
|
||||
const handle = dirBinding.opendirSync(
|
||||
pathModule.toNamespacedPath(path),
|
||||
);
|
||||
const handle = dirBinding.opendirSync(path);
|
||||
|
||||
return new Dir(handle, path, options);
|
||||
}
|
||||
|
@ -363,6 +363,7 @@ static void OpenDir(const FunctionCallbackInfo<Value>& args) {
|
||||
|
||||
BufferValue path(isolate, args[0]);
|
||||
CHECK_NOT_NULL(*path);
|
||||
ToNamespacedPath(env, &path);
|
||||
|
||||
const enum encoding encoding = ParseEncoding(isolate, args[1], UTF8);
|
||||
|
||||
@ -406,6 +407,7 @@ static void OpenDirSync(const FunctionCallbackInfo<Value>& args) {
|
||||
|
||||
BufferValue path(isolate, args[0]);
|
||||
CHECK_NOT_NULL(*path);
|
||||
ToNamespacedPath(env, &path);
|
||||
THROW_IF_INSUFFICIENT_PERMISSIONS(
|
||||
env, permission::PermissionScope::kFileSystemRead, path.ToStringView());
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user