This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
Grimtin10's profile picture

Deleting startup results in "Access Denied"

Started by Grimtin10, 04 May 2018 - 01:36 AM
Grimtin10 #1
Posted 04 May 2018 - 03:36 AM
So, I'm trying to make an anti-virus (because I made a virus) but now when I try to delete startup, it results in "Access Denied".
Help!
Code:

local h = fs.open("startup", "r")
if(h) then
  local l = h.readLine()
  if(l=="--BLUESCREEN VIRUS") then
    fs.delete("startup")
    print("The Trogan.BLUESCREEN malware was detected and removed.")
  else
    print("No viruses found here!")
  end
  h.close()
else
print("No viruses found here!")
end
Bomb Bloke #2
Posted 04 May 2018 - 04:16 AM
Close your file handle before attempting to delete the file.
Grimtin10 #3
Posted 04 May 2018 - 10:20 PM
Close your file handle before attempting to delete the file.
I did.
Wait… did I not save??

Oops, I forgot to save. Thanks for the help though!