partial file list sorting refactor was borked
Steve Donovan
10 years ago
420 | 420 | function M.process_file_list (list, mask, operation, ...) |
421 | 421 | local exclude_list = list.exclude and M.files_from_list(list.exclude, mask) |
422 | 422 | local files = List() |
423 | local function process (f,...) | |
423 | local function process (f) | |
424 | 424 | f = M.abspath(f) |
425 | 425 | if not exclude_list or exclude_list and exclude_list:index(f) == nil then |
426 | 426 | files:append(f) |
428 | 428 | end |
429 | 429 | for _,f in ipairs(list) do |
430 | 430 | 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) | |
434 | 434 | end |
435 | 435 | elseif path.isfile(f) then |
436 | files:append(f) | |
436 | process(f) | |
437 | 437 | else |
438 | 438 | quit("file or directory does not exist: "..M.quote(f)) |
439 | 439 | end |
440 | 440 | end |
441 | ||
441 | 442 | if list.sortfn then |
442 | 443 | files:sort(list.sortfn) |
443 | 444 | end |
445 | ||
444 | 446 | for f in files:iter() do |
445 | 447 | operation(f,...) |
446 | 448 | end |