Skip to content

Commit

Permalink
Report self fs if available
Browse files Browse the repository at this point in the history
  • Loading branch information
javalikescript committed Jul 6, 2024
1 parent 786a309 commit cf8c56c
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions extensions/self/self.lua
Original file line number Diff line number Diff line change
Expand Up @@ -288,10 +288,12 @@ local function refreshLua()
luaThing:updatePropertyValue('engine_start_date', engineStartDate)
luaThing:updatePropertyValue('system_start_date', systemStartDate)

local stat = luv.fs_statfs('.')
if stat then
luaThing:updatePropertyValue('total_fs', stat.bsize * stat.blocks)
luaThing:updatePropertyValue('used_fs', 100 - (stat.bfree * 1000 // stat.blocks) / 10)
if luaThing:hasProperty('used_fs') then
local stat = luv.fs_statfs('.')
if stat then
luaThing:updatePropertyValue('total_fs', stat.bsize * stat.blocks)
luaThing:updatePropertyValue('used_fs', 100 - (stat.bfree * 1000 // stat.blocks) / 10)
end
end
end
lastClock = clock
Expand Down

0 comments on commit cf8c56c

Please sign in to comment.