diff --git a/src/node_file.cc b/src/node_file.cc index 1c832d2fe3b737..ef27c65dd9b7ca 100644 --- a/src/node_file.cc +++ b/src/node_file.cc @@ -3130,12 +3130,18 @@ static void CpSyncCheckPaths(const FunctionCallbackInfo& args) { ToNamespacedPath(env, &src); THROW_IF_INSUFFICIENT_PERMISSIONS( env, permission::PermissionScope::kFileSystemRead, src.ToStringView()); + #ifdef _WIN32 auto src_path = std::filesystem::path(src.ToU8StringView()); #else auto src_path = std::filesystem::path(src.ToStringView()); #endif + std::cout << src.ToStringView() << std::endl; + // auto a = std::filesystem::path(src.ToStringView()); + // std::cout << "A.string: " + a.string() << std::endl; + + BufferValue dest(isolate, args[1]); CHECK_NOT_NULL(*dest); ToNamespacedPath(env, &dest); @@ -3166,7 +3172,9 @@ static void CpSyncCheckPaths(const FunctionCallbackInfo& args) { (src_status.type() == std::filesystem::file_type::directory) || (dereference && src_status.type() == std::filesystem::file_type::symlink); + std::cout << "before innfer " + error_code.message() << std::endl; if (!error_code) { + std::cout << "inner " + error_code.message() << std::endl; // Check if src and dest are identical. if (std::filesystem::equivalent(src_path, dest_path)) { std::string message = @@ -3247,6 +3255,8 @@ static void CpSyncCheckPaths(const FunctionCallbackInfo& args) { // Optimization opportunity: Check if this "exists" call is good for // performance. + std::cout << error_code << std::endl; + std::cout << dest_path.parent_path() << std::endl; if (!dest_exists || !std::filesystem::exists(dest_path.parent_path())) { std::filesystem::create_directories(dest_path.parent_path(), error_code); } diff --git "a/test/fixtures/copy/utf/\346\226\260\345\273\272\346\226\207\344\273\266/index.js" "b/test/fixtures/copy/utf/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/index.js" similarity index 100% rename from "test/fixtures/copy/utf/\346\226\260\345\273\272\346\226\207\344\273\266/index.js" rename to "test/fixtures/copy/utf/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/index.js" diff --git a/test/parallel/test-fs-cp.mjs b/test/parallel/test-fs-cp.mjs index fcd85b52e0adca..b2b42b1334d6bb 100644 --- a/test/parallel/test-fs-cp.mjs +++ b/test/parallel/test-fs-cp.mjs @@ -31,12 +31,12 @@ function nextdir() { // Synchronous implementation of copy. // It copies a nested folder containing UTF characters. -// { -// const src = './test/fixtures/copy/utf/新建文件'; -// const dest = nextdir(); -// cpSync(src, dest, mustNotMutateObjectDeep({ recursive: true })); -// assertDirEquivalent(src, dest); -// } +{ + const src = './test/fixtures/copy/utf/新建文件夹'; + const dest = nextdir(); + cpSync(src, dest, mustNotMutateObjectDeep({ recursive: true })); + assertDirEquivalent(src, dest); +} // It copies a nested folder structure with files and folders. {