Here is a little trick that I have used multiple times for resource packs for servers to prevent editing or even opening of a file. You would want to put this at the beginning or near the beginning of your OS.
local _fs = {}
local oldcomb = fs.combine
local oldlower = string.lower
local blockedpaths = {
["put"] = true,
["paths"] = true,
["here"] = true
}
for k,v in pairs(fs) do
_fs[k] = function(path,...)
if blockedpaths[oldcomb("/",path):oldlower()] then
return nil
else
return v(path,...)
end
end
end
fs = _fs
That code above would block access to any file in the blockedpaths table from even being passed to a fs argument. It effectively blocks the file from all outside programs until computer restart.
Although this works i doubt you would want to take such drastic measure this would probably be enough
local oldOpen = fs.open
local oldComb = fs.combine
local oldLower = string.lower
fs.open = function(path,mode)
if oldComb("/",path):oldLower() == (Your Path) then
return oldOpen(path,mode)
end
end
This prevents anything from editing the paths, while your fix still allows the file itself to be opened using fs.open and thus modified.
Btw even if you create a file named edit people can still use a exact path to /rom/programs/edit and access the old edit program.
edit:
As for your other problem I am unable to recreate it.