Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion src/node_file.cc
Original file line number Diff line number Diff line change
Expand Up @@ -3680,6 +3680,12 @@ std::vector<std::string> normalizePathToArray(
const std::filesystem::path& path) {
std::vector<std::string> parts;
std::filesystem::path absPath = std::filesystem::absolute(path);
#ifdef _WIN32
auto wstr = absPath.wstring();
if (wstr.starts_with(L"\\\\?\\")) {
absPath = std::filesystem::path(wstr.substr(4));
}
#endif
for (const auto& part : absPath) {
if (!part.empty()) parts.push_back(part.string());
}
Expand Down Expand Up @@ -3818,6 +3824,12 @@ static void CpSyncCopyDir(const FunctionCallbackInfo<Value>& args) {
}
auto symlink_target_absolute = std::filesystem::weakly_canonical(
std::filesystem::absolute(src / symlink_target));
#ifdef _WIN32
auto wstr = symlink_target_absolute.wstring();
if (wstr.starts_with(L"\\\\?\\")) {
symlink_target_absolute = std::filesystem::path(wstr.substr(4));
}
#endif
if (dir_entry.is_directory()) {
std::filesystem::create_directory_symlink(
symlink_target_absolute, dest_file_path, error);
Expand All @@ -3841,7 +3853,7 @@ static void CpSyncCopyDir(const FunctionCallbackInfo<Value>& args) {
std::filesystem::copy_file(
dir_entry.path(), dest_file_path, file_copy_opts, error);
if (error) {
if (error.value() == EEXIST) {
if (error == std::errc::file_exists) {
THROW_ERR_FS_CP_EEXIST(isolate,
"[ERR_FS_CP_EEXIST]: Target already exists: "
"cp returned EEXIST (%s already exists)",
Expand Down
2 changes: 0 additions & 2 deletions test/parallel/parallel.status
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,8 @@ test-inspector-network-fetch: PASS, FLAKY
# https://github.com/nodejs/node/issues/54808
test-async-context-frame: PASS, FLAKY
# https://github.com/nodejs/node/issues/59636
test-fs-cp-sync-error-on-exist: SKIP
test-fs-cp-sync-symlink-points-to-dest-error: SKIP
test-fs-cp-async-symlink-points-to-dest: SKIP
test-fs-cp-sync-unicode-folder-names: SKIP

# https://github.com/nodejs/node/issues/56751
test-without-async-context-frame: PASS, FLAKY
Expand Down
Loading