-- vim:set ft=lua: dofile(mg.script_name:gsub('[^\\/]*$','')..'util.lua') ct=CreateContentBuilder(GZIP_THRESHOLD_BYTE) ct:Append(DOCTYPE_HTML4_STRICT..[=[ ストレージ - EDCB

ストレージ

]=]) checked={} for i,v in ipairs(EdcbRecFolderPathList()) do if WIN32 then v=v:match('^[A-Za-z]:\\') if v and not checked[v:upper()] then checked[v:upper()]=true free=nil f=edcb.io.popen('fsutil volume diskfree '..v) if f then --最近のfsutilは数値に桁区切りがつく。さらに最近のものは項目が増えた。 free,total,avail=f:read('*a'):gsub("[%s',.]",''):match(':(%d+).-:(%d+).-:(%d+)') f:close() end ct:Append('
'..v..'
'..(free and ('%.3f GiB (avail: %.3f GiB) / %.3f GiB'):format(free/1024/1024/1024,avail/1024/1024/1024,total/1024/1024/1024) or '不明')..'
\n') end else total=nil f=edcb.io.popen('df -P -BM '..QuoteCommandArgForPath(v)..' 2>/dev/null | sed "s/ */ /g" | cut -f2-4 -d" "') if f then total,used,avail=f:read('*a'):match('(%d+)M (%d+)M (%d+)M') f:close() end if total then edcb.htmlEscape=15 ct:Append('
'..EdcbHtmlEscape(v)..'
'..('%.3f GiB (avail: %.3f GiB) / %.3f GiB'):format((total-used)/1024,avail/1024,total/1024)..'
\n') edcb.htmlEscape=0 end end end ct:Append([=[
]=]) ct:Finish() mg.write(ct:Pop(Response(200,'text/html','utf-8',ct.len,ct.gzip)..'\r\n'))