@@ -133,13 +133,8 @@ local function do_copy(source, destination)
133
133
134
134
local new_name = source .. ' /' .. name
135
135
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
143
138
end
144
139
145
140
return true
@@ -173,10 +168,18 @@ local function do_paste(node, action_type, action_fn)
173
168
174
169
for _ , entry in ipairs (clip ) do
175
170
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 )
177
179
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 )
179
181
end
182
+ :: continue::
180
183
end
181
184
clipboard [action_type ] = {}
182
185
return refresh_tree ()
0 commit comments