--------------------------------------------------------- --- Extended fs library for luvit. -------------------------------------------------------- return function(fs) -- Removes a directory + all of it's subdirectories. fs.rmsubdir = function(path, cb) fs.readdir(path, function(err, files) if err or (not files) then cb(err) else for k,v in pairs(files) do local stats = fs.statSync(path .. "/" .. tostring(v)) if stats.is_file then local ret = fs.unlinkSync(path .. "/" .. tostring(v)) if ret then cb(ret) return end elseif stats then local ret = fs.rmsubdir(path .. "/" .. tostring(v)) if ret then cb(ret) return end end end fs.rmdir(path, cb) end end) end end