Hello everyone,
I've been working on an OS thats going to be published soon but I need some help with fs.delete(). I am making a systemWipe program that wipes all the files and folders on the system but I need to blacklist certain items like the "rom" directory and other things. This is my code so far:
[attachment=2012:postImg.JPG]
I have the blacklist table, but I don't know how to implement it. I was looking at the OneOS blacklist but that never worked and I wanted some help of you guys so I can get this bleedin systemWipe program sorted.
Your most and humble servant,
smigger22
How to blacklist certain items
Started by _removed, Dec 17 2014 06:12 PM
4 replies to this topic
#1
Posted 17 December 2014 - 06:12 PM
#2
Posted 17 December 2014 - 06:28 PM
My suggestion would be to use the blacklist as a lookup stead:
This means you can do this:
This will only work if the path exactly the same (so thing/rom will still be deleted).
local blacklist = {
['rom'] = true,
}
This means you can do this:
for _, file in ipairs(files) do
if not blacklist[file] and not blacklist['/'..file] then
fs.delete(file)
end
end
This will only work if the path exactly the same (so thing/rom will still be deleted).
#3
Posted 17 December 2014 - 06:51 PM
Thx SquidDev, been waiting a long time for an answer while working on the other aspects of my OS
#4
Posted 17 December 2014 - 09:18 PM
You should also check if the folder or file you are trying to delete is read-only or not. That actully would save you from trouble adding rom to the whitelist and trying to figure out if there is a disk drive connected.
#5
Posted 19 December 2014 - 09:49 PM
Thx for the feedback, the OS will now be published soon!!!
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users











