Posted 26 March 2013 - 05:22 PM
Hi!
Please add a function to get the total space limit in a computer or floppy disk. I think this is good because we can change the disk space in config of CC.
Like this we can make a complete memory utility for our OS or other.
PS: fs.getFreeSpace() is not referenced in wiki.
EDIT : a moderator can lock this topic.
I created a function :
Please add a function to get the total space limit in a computer or floppy disk. I think this is good because we can change the disk space in config of CC.
Like this we can make a complete memory utility for our OS or other.
PS: fs.getFreeSpace() is not referenced in wiki.
EDIT : a moderator can lock this topic.
I created a function :
fs.getSpaceLimit = function(_path, _space, _final)
local final = true
if(_final ~= nil) then
final = _final
end
local space = 0
if(_space ~= nil) then
space = _space
end
local sDir = ""
if _path ~= nil then sDir = _path end
local tContent = fs.list( sDir )
for i, j in pairs( tContent ) do
local sPath = fs.combine( sDir, j )
if fs.isDir( sPath ) then
if(sPath ~= "rom") then
space = space + 512
space = fs.getSpaceLimit(sPath, space, false)
end
else
space = space + fs.getSize(sPath)
end
end
if(final == true) then
return space + fs.getFreeSpace("")
else
return space
end
end