From 5aa216320e12e8c2407eb68c3ccae03546a07aa5 Mon Sep 17 00:00:00 2001 From: Yagiz Nizipli Date: Thu, 4 Jul 2024 12:19:36 -0400 Subject: [PATCH] v8: move `ToNamespacedPath` to c++ MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit PR-URL: https://github.com/nodejs/node/pull/53655 Reviewed-By: Vinícius Lourenço Claro Cardoso Reviewed-By: James M Snell --- lib/v8.js | 2 -- src/heap_utils.cc | 2 ++ 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/v8.js b/lib/v8.js index d6f7d2ca47251a..b687d8709c99a0 100644 --- a/lib/v8.js +++ b/lib/v8.js @@ -53,7 +53,6 @@ const { copy } = internalBinding('buffer'); const { inspect } = require('internal/util/inspect'); const { FastBuffer } = require('internal/buffer'); const { getValidatedPath } = require('internal/fs/utils'); -const { toNamespacedPath } = require('path'); const { createHeapSnapshotStream, triggerHeapSnapshot, @@ -78,7 +77,6 @@ const { getOptionValue } = require('internal/options'); function writeHeapSnapshot(filename, options) { if (filename !== undefined) { filename = getValidatedPath(filename); - filename = toNamespacedPath(filename); } const optionArray = getHeapSnapshotOptions(options); return triggerHeapSnapshot(filename, optionArray); diff --git a/src/heap_utils.cc b/src/heap_utils.cc index e385955a5d5fce..f55255be5fd428 100644 --- a/src/heap_utils.cc +++ b/src/heap_utils.cc @@ -2,6 +2,7 @@ #include "env-inl.h" #include "memory_tracker-inl.h" #include "node_external_reference.h" +#include "path.h" #include "permission/permission.h" #include "stream_base-inl.h" #include "util-inl.h" @@ -468,6 +469,7 @@ void TriggerHeapSnapshot(const FunctionCallbackInfo& args) { BufferValue path(isolate, filename_v); CHECK_NOT_NULL(*path); + ToNamespacedPath(env, &path); THROW_IF_INSUFFICIENT_PERMISSIONS( env, permission::PermissionScope::kFileSystemWrite, path.ToStringView()); if (WriteSnapshot(env, *path, options).IsNothing()) return;