@@ -133,13 +133,8 @@ local function do_copy(source, destination)
133133
134134 local new_name = source .. ' /' .. name
135135 local new_destination = destination .. ' /' .. name
136- if t == ' directory' then
137- local success = do_copy (new_name , new_destination )
138- if not success then return false end
139- else
140- local success = luv .fs_copyfile (new_name , new_destination )
141- if not success then return false end
142- end
136+ local success , msg = do_copy (new_name , new_destination )
137+ if not success then return success , msg end
143138 end
144139
145140 return true
@@ -173,10 +168,18 @@ local function do_paste(node, action_type, action_fn)
173168
174169 for _ , entry in ipairs (clip ) do
175170 local dest = destination .. ' /' .. entry .name
176- local success = action_fn (entry .absolute_path , dest )
171+ local dest_stats = luv .fs_stat (dest )
172+ if dest_stats then
173+ local ans = vim .fn .input (dest .. ' already exists, overwrite ? y/n: ' )
174+ clear_prompt ()
175+ if not ans :match (' ^y' ) then goto continue end
176+ end
177+
178+ local success , msg = action_fn (entry .absolute_path , dest )
177179 if not success then
178- api .nvim_err_writeln (' Could not ' .. action_type .. ' ' .. entry .absolute_path )
180+ api .nvim_err_writeln (' Could not ' .. action_type .. ' ' .. entry .absolute_path .. ' - ' .. msg )
179181 end
182+ :: continue::
180183 end
181184 clipboard [action_type ] = {}
182185 return refresh_tree ()
0 commit comments