Codebase list lua-ldoc / 3e78c47
partial file list sorting refactor was borked Steve Donovan 10 years ago
1 changed file(s) with 7 addition(s) and 5 deletion(s). Raw diff Collapse all Expand all
420420 function M.process_file_list (list, mask, operation, ...)
421421 local exclude_list = list.exclude and M.files_from_list(list.exclude, mask)
422422 local files = List()
423 local function process (f,...)
423 local function process (f)
424424 f = M.abspath(f)
425425 if not exclude_list or exclude_list and exclude_list:index(f) == nil then
426426 files:append(f)
428428 end
429429 for _,f in ipairs(list) do
430430 if path.isdir(f) then
431 local files = List(dir.getallfiles(f,mask))
432 for f in files:iter() do
433 files:append(f)
431 local dfiles = List(dir.getallfiles(f,mask))
432 for f in dfiles:iter() do
433 process(f)
434434 end
435435 elseif path.isfile(f) then
436 files:append(f)
436 process(f)
437437 else
438438 quit("file or directory does not exist: "..M.quote(f))
439439 end
440440 end
441
441442 if list.sortfn then
442443 files:sort(list.sortfn)
443444 end
445
444446 for f in files:iter() do
445447 operation(f,...)
446448 end