--Remote FS client modifier orig_fslist=_G.fs.list _G.fs.list=function (pth) if(string.sub(pth,1,3)=="::") then modpth=textutils.unserialize("{\""..string.gsub(pth, "/", "\",\"", 1).."\"}") id=rednet.lookup("remfs", string.sub(modpth[1],3)) rednet.send(id, {"list",modpth[2]},"remfs") sid, msg = rednet.receive("remfs") return msg else return orig_fslist(pth) end end orig_fsexists=_G.fs.exists _G.fs.exists=function (pth) if(string.sub(pth,1,3)=="::") then modpth=textutils.unserialize("{\""..string.gsub(pth, "/", "\",\"", 1).."\"}") id=rednet.lookup("remfs", string.sub(modpth[1],3)) rednet.send(id, {"exists",modpth[2]},"remfs") sid, msg = rednet.receive("remfs") return msg else return orig_fsexists(pth) end end orig_fsisDir=_G.fs.isDir _G.fs.isDir=function (pth) if(string.sub(pth,1,3)=="::") then modpth=textutils.unserialize("{\""..string.gsub(pth, "/", "\",\"", 1).."\"}") id=rednet.lookup("remfs", string.sub(modpth[1],3)) rednet.send(id, {"isDir",modpth[2]},"remfs") sid, msg = rednet.receive("remfs") return msg else return orig_fsisDir(pth) end end orig_fsisReadOnly=_G.fs.isReadOnly _G.fs.isReadOnly=function (pth) if(string.sub(pth,1,3)=="::") then modpth=textutils.unserialize("{\""..string.gsub(pth, "/", "\",\"", 1).."\"}") id=rednet.lookup("remfs", string.sub(modpth[1],3)) rednet.send(id, {"isReadOnly",modpth[2]},"remfs") sid, msg = rednet.receive("remfs") return msg else return orig_fsisReadOnly(pth) end end orig_fsgetDrive=_G.fs.getDrive _G.fs.getDrive=function (pth) if(string.sub(pth,1,3)=="::") then return "remfs" else return orig_fsgetDrive(pth) end end orig_fsgetSize=_G.fs.getSize _G.fs.getSize=function (pth) if(string.sub(pth,1,3)=="::") then modpth=textutils.unserialize("{\""..string.gsub(pth, "/", "\",\"", 1).."\"}") id=rednet.lookup("remfs", string.sub(modpth[1],3)) rednet.send(id, {"getSize",modpth[2]},"remfs") sid, msg = rednet.receive("remfs") return msg else return orig_fsgetSize(pth) end end orig_fsgetFreeSpace=_G.fs.getFreeSpace _G.fs.getFreeSpace=function (pth) if(string.sub(pth,1,3)=="::") then modpth=textutils.unserialize("{\""..string.gsub(pth, "/", "\",\"", 1).."\"}") id=rednet.lookup("remfs", string.sub(modpth[1],3)) rednet.send(id, {"getFreeSpace",modpth[2]},"remfs") sid, msg = rednet.receive("remfs") return msg else return orig_fsgetFreeSpace(pth) end end orig_fsfind=_G.fs.find _G.fs.find=function (pth) if(string.sub(pth,1,3)=="::") then modpth=textutils.unserialize("{\""..string.gsub(pth, "/", "\",\"", 1).."\"}") id=rednet.lookup("remfs", string.sub(modpth[1],3)) rednet.send(id, {"find",modpth[2]},"remfs") sid, msg = rednet.receive("remfs") return msg else return orig_fsfind(pth) end end orig_fsdelete=_G.fs.delete _G.fs.delete=function (pth) if(string.sub(pth,1,3)=="::") then modpth=textutils.unserialize("{\""..string.gsub(pth, "/", "\",\"", 1).."\"}") if #modpth==1 then return orig_fsdelete(pth) end id=rednet.lookup("remfs", string.sub(modpth[1],3)) rednet.send(id, {"delete",modpth[2]},"remfs") sid, msg = rednet.receive("remfs") return msg else return orig_fsdelete(pth) end end orig_fsmakeDir=_G.fs.makeDir _G.fs.makeDir=function (pth) if(string.sub(pth,1,3)=="::") then modpth=textutils.unserialize("{\""..string.gsub(pth, "/", "\",\"", 1).."\"}") if #modpth==1 then return orig_fsmakeDir(pth) end id=rednet.lookup("remfs", string.sub(modpth[1],3)) rednet.send(id, {"makeDir",modpth[2]},"remfs") sid, msg = rednet.receive("remfs") return msg else return orig_fsmakeDir(pth) end end _G.fs.readAll=function (pth) if(string.sub(pth,1,3)=="::") then modpth=textutils.unserialize("{\""..string.gsub(pth, "/", "\",\"", 1).."\"}") id=rednet.lookup("remfs", string.sub(modpth[1],3)) rednet.send(id, {"readAll",modpth[2]},"remfs") sid, msg = rednet.receive("remfs") return msg else h=orig_fsopen(pth,"r") srr=h.readAll() h.close() return h end end _G.fs.writeAll=function (pth,dta) if(string.sub(pth,1,3)=="::") then modpth=textutils.unserialize("{\""..string.gsub(pth, "/", "\",\"", 1).."\"}") id=rednet.lookup("remfs", string.sub(modpth[1],3)) rednet.send(id, {"writeAll",modpth[2],dta},"remfs") sid, msg = rednet.receive("remfs") return msg else h=orig_fsopen(pth,"w") h.write(dta) h.close() return h end end orig_fscopy=_G.fs.copy _G.fs.copy=function (pth,dest) if(string.sub(pth,1,3)=="::") or (string.sub(dest,1,3)=="::") then fs.writeAll(dest,fs.readAll(pth)) else orig_fscopy(pth,dest) end end orig_fsmove=_G.fs.move _G.fs.move=function (pth,dest) if(string.sub(pth,1,3)=="::") or (string.sub(dest,1,3)=="::") then fs.writeAll(dest,fs.readAll(pth)) fs.delete(pth) else orig_fsmove(pth,dest) end end orig_fsopen=_G.fs.open _G.fs.open=function (pth,typ) if(string.sub(pth,1,3)=="::") then modpth=textutils.unserialize("{\""..string.gsub(pth, "/", "\",\"", 1).."\"}") id=rednet.lookup("remfs", string.sub(modpth[1],3)) rednet.send(id, {"list",modpth[2]},"remfs") sid, msg = rednet.receive("remfs") hand={} hand.hhid=nil hand.id=nil hand.close=function () id=rednet.lookup("remfs", rrrhost,3)) rednet.send(id, {"close",nil,hhid},"remfsh") end hand.write=function (dta) rednet.send(id, {"write",dta,hhid},"remfsh") end hand.writeLine=function (dta) rednet.send(id, {"writeLine",dta,hhid},"remfsh") end hand.flush=function () rednet.send(id, {"flush",nil,hhid},"remfsh") end hand.read=function () rednet.send(id, {true,"read",nil,hhid},"remfs") sid, msg = rednet.receive("remfsh") return msg end hand.readLine=function () rednet.send(id, {true,"readLine",nil,hhid},"remfs") sid, msg = rednet.receive("remfsh") return msg end hand.readAll=function () rednet.send(id, {true,"readAll",nil,hhid},"remfs") sid, msg = rednet.receive("remfsh") return msg end --} hand.hhid=msg hand.id=rednet.lookup("remfsh", string.sub(modpth[1],3)) return hand else return orig_fsopen(pth) end end