mirror of
https://github.com/neovim/neovim.git
synced 2024-12-19 18:55:14 -07:00
fix(lsp): rename fails on missing parent directory #27291
Problem: If a rename results in a path that has missing parent directory(s), it will fail. Solution: Do a recursive mkdir before attempting the rename.
This commit is contained in:
parent
52b6a9a93b
commit
f0e61e6d92
@ -693,6 +693,9 @@ function M.rename(old_fname, new_fname, opts)
|
|||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local newdir = assert(vim.fs.dirname(new_fname))
|
||||||
|
vim.fn.mkdir(newdir, 'p')
|
||||||
|
|
||||||
local ok, err = os.rename(old_fname, new_fname)
|
local ok, err = os.rename(old_fname, new_fname)
|
||||||
assert(ok, err)
|
assert(ok, err)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user