mirror of
				https://github.com/neovim/neovim.git
				synced 2025-11-04 01:34:25 +00:00 
			
		
		
		
	test: rmdir(): recursively delete
This commit is contained in:
		@@ -345,10 +345,18 @@ local function rmdir(path)
 | 
				
			|||||||
  end
 | 
					  end
 | 
				
			||||||
  for file in lfs.dir(path) do
 | 
					  for file in lfs.dir(path) do
 | 
				
			||||||
    if file ~= '.' and file ~= '..' then
 | 
					    if file ~= '.' and file ~= '..' then
 | 
				
			||||||
      local ret, err = os.remove(path..'/'..file)
 | 
					      local abspath = path..'/'..file
 | 
				
			||||||
      if not ret then
 | 
					      if lfs.attributes(abspath, 'mode') == 'directory' then
 | 
				
			||||||
        error('os.remove: '..err)
 | 
					        local ret = rmdir(abspath)  -- recurse
 | 
				
			||||||
        return nil
 | 
					        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
 | 
					    end
 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user