Skip to content

Commit

Permalink
fix: update opened directory stat
Browse files Browse the repository at this point in the history
  • Loading branch information
amedama41 committed Jul 29, 2023
1 parent 853cc01 commit e9667d4
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
1 change: 1 addition & 0 deletions lua/vfiler/context.lua
Original file line number Diff line number Diff line change
Expand Up @@ -335,6 +335,7 @@ function Context:reload()
for dir in walk_directories(self.root) do
if dir.opened then
if vim.fn.getftime(dir.path) > dir.time then
dir:update_stat()
dir:open()
end
end
Expand Down
10 changes: 10 additions & 0 deletions lua/vfiler/items/directory.lua
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,16 @@ function Directory:open(recursive)
self.opened = true
end

function Directory:update_stat()
local stat = fs.stat(self.path)
if not stat then
return
end
self.size = stat.size
self.time = stat.time
self.mode = stat.mode
end

function Directory:_add(item)
item.parent = self
item.level = self.level + 1
Expand Down

0 comments on commit e9667d4

Please sign in to comment.