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) {
3130
3130
ToNamespacedPath (env, &src);
3131
3131
THROW_IF_INSUFFICIENT_PERMISSIONS (
3132
3132
env, permission::PermissionScope::kFileSystemRead , src.ToStringView ());
3133
- auto src_path = std::filesystem::path (src.ToStringView ());
3133
+ auto src_path = std::filesystem::path (src.ToStringU8View ());
3134
3134
3135
3135
BufferValue dest (isolate, args[1 ]);
3136
3136
CHECK_NOT_NULL (*dest);
3137
3137
ToNamespacedPath (env, &dest);
3138
3138
THROW_IF_INSUFFICIENT_PERMISSIONS (
3139
3139
env, permission::PermissionScope::kFileSystemWrite , dest.ToStringView ());
3140
- auto dest_path = std::filesystem::path (dest.ToStringView ());
3140
+ auto dest_path = std::filesystem::path (dest.ToStringU8View ());
3141
3141
3142
3142
bool dereference = args[2 ]->IsTrue ();
3143
3143
bool recursive = args[3 ]->IsTrue ();
Original file line number Diff line number Diff line change @@ -562,6 +562,10 @@ class BufferValue : public MaybeStackBuffer<char> {
562
562
inline std::string_view ToStringView () const {
563
563
return std::string_view (out (), length ());
564
564
}
565
+ inline std::u8string_view ToStringU8View () const {
566
+ return std::u8string_view (reinterpret_cast <const char8_t *>(out ()),
567
+ length ());
568
+ }
565
569
};
566
570
567
571
#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() {
30
30
31
31
// Synchronous implementation of copy.
32
32
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
+
33
41
// It copies a nested folder structure with files and folders.
34
42
{
35
43
const src = './test/fixtures/copy/kitchen-sink' ;
You can’t perform that action at this time.
0 commit comments