Skip to content

Commit 8295110

Browse files
committed
fix: validate original file exists in rename_file
1 parent c78fa9c commit 8295110

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

lua/astrocore/init.lua

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -410,6 +410,10 @@ function M.rename_file(opts)
410410
end
411411
end
412412
from = vim.fn.fnamemodify(from, ":p")
413+
if not vim.uv.fs_stat(from) then
414+
M.notify(("File does not exists:\n`%s`"):format(vim.fn.fnamemodify(from, ":.")), vim.log.levels.ERROR)
415+
return
416+
end
413417

414418
local _rename_file = function(to)
415419
to = vim.fn.fnamemodify(to, ":p")

0 commit comments

Comments
 (0)