feat: add file size in popup (#1049)
This commit is contained in:
committed by
GitHub
parent
5015e7226c
commit
ceadf83809
@@ -5,16 +5,6 @@ local M = {
|
||||
is_windows = vim.fn.has('win32') == 1
|
||||
}
|
||||
|
||||
local function get_last_modified(absolute_path)
|
||||
local stat = uv.fs_stat(absolute_path)
|
||||
|
||||
local last_modified = 0
|
||||
if stat ~= nil then
|
||||
last_modified = stat.mtime.sec
|
||||
end
|
||||
return last_modified
|
||||
end
|
||||
|
||||
function M.get_dir_git_status(parent_ignored, status, absolute_path)
|
||||
if parent_ignored then
|
||||
return '!!'
|
||||
@@ -40,7 +30,7 @@ function M.folder(absolute_path, name, status, parent_ignored)
|
||||
name = name,
|
||||
nodes = {},
|
||||
open = false,
|
||||
last_modified = get_last_modified(absolute_path),
|
||||
fs_stat = uv.fs_stat(absolute_path),
|
||||
}
|
||||
end
|
||||
|
||||
@@ -60,7 +50,7 @@ function M.file(absolute_path, name, status, parent_ignored)
|
||||
extension = ext,
|
||||
git_status = M.get_git_status(parent_ignored, status, absolute_path),
|
||||
name = name,
|
||||
last_modified = get_last_modified(absolute_path),
|
||||
fs_stat = uv.fs_stat(absolute_path),
|
||||
}
|
||||
end
|
||||
|
||||
@@ -82,11 +72,11 @@ function M.link(absolute_path, name, status, parent_ignored)
|
||||
absolute_path = absolute_path,
|
||||
git_status = M.get_git_status(parent_ignored, status, absolute_path),
|
||||
group_next = nil, -- If node is grouped, this points to the next child dir/link node
|
||||
last_modified = get_last_modified(absolute_path),
|
||||
link_to = link_to,
|
||||
name = name,
|
||||
nodes = nodes,
|
||||
open = open,
|
||||
fs_stat = uv.fs_stat(absolute_path),
|
||||
}
|
||||
end
|
||||
|
||||
|
||||
@@ -31,7 +31,18 @@ function M.node_comparator_modification_time(a, b)
|
||||
return false
|
||||
end
|
||||
|
||||
return b.last_modified <= a.last_modified
|
||||
local last_modified_a = 0
|
||||
local last_modified_b = 0
|
||||
|
||||
if a.fs_stat ~= nil then
|
||||
last_modified_a = a.fs_stat.mtime.sec
|
||||
end
|
||||
|
||||
if b.fs_stat ~= nil then
|
||||
last_modified_b = b.fs_stat.mtime.sec
|
||||
end
|
||||
|
||||
return last_modified_a <= last_modified_b
|
||||
end
|
||||
|
||||
---Check if the given path should be ignored.
|
||||
|
||||
Reference in New Issue
Block a user