File tree Expand file tree Collapse file tree 4 files changed +17
-2
lines changed Expand file tree Collapse file tree 4 files changed +17
-2
lines changed Original file line number Diff line number Diff line change @@ -3130,14 +3130,14 @@ static void CpSyncCheckPaths(const FunctionCallbackInfo<Value>& args) {
31303130 ToNamespacedPath (env, &src);
31313131 THROW_IF_INSUFFICIENT_PERMISSIONS (
31323132 env, permission::PermissionScope::kFileSystemRead , src.ToStringView ());
3133- auto src_path = std::filesystem::path (src.ToStringView ());
3133+ auto src_path = std::filesystem::path (src.ToStringU8View ());
31343134
31353135 BufferValue dest (isolate, args[1 ]);
31363136 CHECK_NOT_NULL (*dest);
31373137 ToNamespacedPath (env, &dest);
31383138 THROW_IF_INSUFFICIENT_PERMISSIONS (
31393139 env, permission::PermissionScope::kFileSystemWrite , dest.ToStringView ());
3140- auto dest_path = std::filesystem::path (dest.ToStringView ());
3140+ auto dest_path = std::filesystem::path (dest.ToStringU8View ());
31413141
31423142 bool dereference = args[2 ]->IsTrue ();
31433143 bool recursive = args[3 ]->IsTrue ();
Original file line number Diff line number Diff line change @@ -562,6 +562,10 @@ class BufferValue : public MaybeStackBuffer<char> {
562562 inline std::string_view ToStringView () const {
563563 return std::string_view (out (), length ());
564564 }
565+ inline std::u8string_view ToStringU8View () const {
566+ return std::u8string_view (reinterpret_cast <const char8_t *>(out ()),
567+ length ());
568+ }
565569};
566570
567571#define SPREAD_BUFFER_ARG (val, name ) \
Original file line number Diff line number Diff line change 1+ module . exports = {
2+ purpose : 'testing copy'
3+ } ;
Original file line number Diff line number Diff line change @@ -30,6 +30,14 @@ function nextdir() {
3030
3131// Synchronous implementation of copy.
3232
33+ // It copies a nested folder containing UTF characters.
34+ {
35+ const src = './test/fixtures/copy/utf/新建文件' ;
36+ const dest = nextdir ( ) ;
37+ cpSync ( src , dest , mustNotMutateObjectDeep ( { recursive : true } ) ) ;
38+ assertDirEquivalent ( src , dest ) ;
39+ }
40+
3341// It copies a nested folder structure with files and folders.
3442{
3543 const src = './test/fixtures/copy/kitchen-sink' ;
You can’t perform that action at this time.
0 commit comments