From e9667d4a23da998bf5b12bd2ec09eec6db061376 Mon Sep 17 00:00:00 2001 From: amedama41 Date: Sat, 29 Jul 2023 16:59:54 +0900 Subject: [PATCH] fix: update opened directory stat --- lua/vfiler/context.lua | 1 + lua/vfiler/items/directory.lua | 10 ++++++++++ 2 files changed, 11 insertions(+) diff --git a/lua/vfiler/context.lua b/lua/vfiler/context.lua index b56a70e..24c6743 100644 --- a/lua/vfiler/context.lua +++ b/lua/vfiler/context.lua @@ -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 diff --git a/lua/vfiler/items/directory.lua b/lua/vfiler/items/directory.lua index efce3d3..b7d866e 100644 --- a/lua/vfiler/items/directory.lua +++ b/lua/vfiler/items/directory.lua @@ -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