equal
deleted
inserted
replaced
44 local class = table.concat({ attr.mode or "unknown", file_ext, type and type:match"^[^/]+" }, " "); |
44 local class = table.concat({ attr.mode or "unknown", file_ext, type and type:match"^[^/]+" }, " "); |
45 path.is_directory = attr.mode == "directory"; |
45 path.is_directory = attr.mode == "directory"; |
46 table.insert(filelist, { class = class, href = build_path(path), type = type, text = file }); |
46 table.insert(filelist, { class = class, href = build_path(path), type = type, text = file }); |
47 end |
47 end |
48 end |
48 end |
|
49 table.sort(filelist, function (a, b) |
|
50 if a.href == ".." then return true end |
|
51 if b.href == ".." then return false end |
|
52 if a.class:match"directory" and not b.class:match"directory" then return true end |
|
53 if not a.class:match"directory" and b.class:match"directory" then return false end |
|
54 return a.text < b.text; |
|
55 end); |
49 return render(dir_index_template, { |
56 return render(dir_index_template, { |
50 path = path, |
57 path = path, |
51 style = style, |
58 style = style, |
52 filelist = filelist, |
59 filelist = filelist, |
53 footer = "Prosody "..prosody.version, |
60 footer = "Prosody "..prosody.version, |