mirror of
https://github.com/neovim/neovim.git
synced 2025-10-26 12:27:24 +00:00
test: rmdir(): recursively delete
This commit is contained in:
@@ -345,13 +345,21 @@ local function rmdir(path)
|
||||
end
|
||||
for file in lfs.dir(path) do
|
||||
if file ~= '.' and file ~= '..' then
|
||||
local ret, err = os.remove(path..'/'..file)
|
||||
local abspath = path..'/'..file
|
||||
if lfs.attributes(abspath, 'mode') == 'directory' then
|
||||
local ret = rmdir(abspath) -- recurse
|
||||
if not ret then
|
||||
return nil
|
||||
end
|
||||
else
|
||||
local ret, err = os.remove(abspath)
|
||||
if not ret then
|
||||
error('os.remove: '..err)
|
||||
return nil
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
local ret, err = os.remove(path)
|
||||
if not ret then
|
||||
error('os.remove: '..err)
|
||||
|
||||
Reference in New Issue
Block a user