FoxData, on 19 June 2016 - 09:52 PM, said:
Hi everyone. This API will allow you to perform certain actions on disk drives.
Here are some code snippets:
Drive.ShowSpace - Shows the current space of the HDD returns nil when it has no space
Drive.Wipe - Wipes the HDD
Drive.Park - Parks the HDD heads
Drive.Encrypt - Encrypts the HDD
Drive.Space - A var that returns the space of the drive to if statements
Drives.GetExtDrives - Retrieves Info about external fdd drives
- Here's some proper code
While true do
Print(Drive.ShowSpace)
if Drive.Space = 0.0 then print ("Out of Space")
end
So what do you think of this API? Will it be added to CC? CraftOS 2.0's Drive API?
Everything (okay, not the encryption) can be done with either a normal fs call, or a small amount of lines (using the fs API)
I don't see why this would be needed at all
//EDIT:
Here's an example for "Wipe"
Not tested and written on my phone, but I think you can get the idea
function wipe(start)
start = start or "/"
for k,v in pairs(fs.list(start)) do
if (fs.isDir(fs.combine(start,v)) and not (start == "/" and v== "rom")) then
wipe(fs.combine(start,v))
else
if(not (start == "/" and v == "rom") ) then
fs.delete(fs.combine(start,v)
end
end
end
end
Edited by H4X0RZ, 19 June 2016 - 10:38 PM.