Posted 20 September 2014 - 06:21 PM
I am trying to rewrite the fs api for my operating system but i have been having problems with fs.open(). my code is obviously flawed because every time i use it the OS drops everything but itself. if you try to use any commands it says file not found. here is my code
can i get some help with this please.
local error1 = "fs error 1: This File is locked"
local error2 = "fs error 2: This File is read only"
local oldfs = {}
for k,v in pairs( fs ) do
oldfs[k] = v
end
function fs.move( fpath , tpath)
if fpath:sub(1,1) == ',' then
print("fs error 1: This File is locked")
else
oldfs.move(fpath,tpath)
end
end
function fs.opened( path,mode)
if path:sub(1,1) == ',' then
print(error2)
oldfs.open(path,'r')
else oldfs.open(path,mode)
end
end
function fs.delete(path)
if path:sub(1,1)==',' then
error(error1)
else
oldfs.delete(path)
end
end
can i get some help with this please.