chore: resolve undefined-field
This commit is contained in:
@@ -45,10 +45,8 @@ end
|
|||||||
---@return boolean
|
---@return boolean
|
||||||
---@return string|nil
|
---@return string|nil
|
||||||
local function do_copy(source, destination)
|
local function do_copy(source, destination)
|
||||||
local source_stats, handle
|
local source_stats, errmsg = vim.loop.fs_stat(source)
|
||||||
local success, errmsg
|
|
||||||
|
|
||||||
source_stats, errmsg = vim.loop.fs_stat(source)
|
|
||||||
if not source_stats then
|
if not source_stats then
|
||||||
log.line("copy_paste", "do_copy fs_stat '%s' failed '%s'", source, errmsg)
|
log.line("copy_paste", "do_copy fs_stat '%s' failed '%s'", source, errmsg)
|
||||||
return false, errmsg
|
return false, errmsg
|
||||||
@@ -62,6 +60,7 @@ local function do_copy(source, destination)
|
|||||||
end
|
end
|
||||||
|
|
||||||
if source_stats.type == "file" then
|
if source_stats.type == "file" then
|
||||||
|
local success
|
||||||
success, errmsg = vim.loop.fs_copyfile(source, destination)
|
success, errmsg = vim.loop.fs_copyfile(source, destination)
|
||||||
if not success then
|
if not success then
|
||||||
log.line("copy_paste", "do_copy fs_copyfile failed '%s'", errmsg)
|
log.line("copy_paste", "do_copy fs_copyfile failed '%s'", errmsg)
|
||||||
@@ -69,6 +68,7 @@ local function do_copy(source, destination)
|
|||||||
end
|
end
|
||||||
return true
|
return true
|
||||||
elseif source_stats.type == "directory" then
|
elseif source_stats.type == "directory" then
|
||||||
|
local handle
|
||||||
handle, errmsg = vim.loop.fs_scandir(source)
|
handle, errmsg = vim.loop.fs_scandir(source)
|
||||||
if type(handle) == "string" then
|
if type(handle) == "string" then
|
||||||
return false, handle
|
return false, handle
|
||||||
@@ -77,6 +77,7 @@ local function do_copy(source, destination)
|
|||||||
return false, errmsg
|
return false, errmsg
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local success
|
||||||
success, errmsg = vim.loop.fs_mkdir(destination, source_stats.mode)
|
success, errmsg = vim.loop.fs_mkdir(destination, source_stats.mode)
|
||||||
if not success then
|
if not success then
|
||||||
log.line("copy_paste", "do_copy fs_mkdir '%s' failed '%s'", destination, errmsg)
|
log.line("copy_paste", "do_copy fs_mkdir '%s' failed '%s'", destination, errmsg)
|
||||||
|
|||||||
Reference in New Issue
Block a user