File tree 1 file changed +4
-3
lines changed 1 file changed +4
-3
lines changed Original file line number Diff line number Diff line change 45
45
--- @return boolean
46
46
--- @return string | nil
47
47
local function do_copy (source , destination )
48
- local source_stats , handle
49
- local success , errmsg
48
+ local source_stats , errmsg = vim .loop .fs_stat (source )
50
49
51
- source_stats , errmsg = vim .loop .fs_stat (source )
52
50
if not source_stats then
53
51
log .line (" copy_paste" , " do_copy fs_stat '%s' failed '%s'" , source , errmsg )
54
52
return false , errmsg
@@ -62,13 +60,15 @@ local function do_copy(source, destination)
62
60
end
63
61
64
62
if source_stats .type == " file" then
63
+ local success
65
64
success , errmsg = vim .loop .fs_copyfile (source , destination )
66
65
if not success then
67
66
log .line (" copy_paste" , " do_copy fs_copyfile failed '%s'" , errmsg )
68
67
return false , errmsg
69
68
end
70
69
return true
71
70
elseif source_stats .type == " directory" then
71
+ local handle
72
72
handle , errmsg = vim .loop .fs_scandir (source )
73
73
if type (handle ) == " string" then
74
74
return false , handle
@@ -77,6 +77,7 @@ local function do_copy(source, destination)
77
77
return false , errmsg
78
78
end
79
79
80
+ local success
80
81
success , errmsg = vim .loop .fs_mkdir (destination , source_stats .mode )
81
82
if not success then
82
83
log .line (" copy_paste" , " do_copy fs_mkdir '%s' failed '%s'" , destination , errmsg )
You can’t perform that action at this time.
0 commit comments