Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local fsredirectPath = "/"
- local fsapi = {}
- for i,k in pairs(_G.fs) do
- fsapi[i] = k
- end
- _G.fs.getPath = function()
- return fsredirectPath
- end
- _G.fs.setPath = function(path)
- if not path then
- error("Expected string")
- end
- local path = tostring(path)
- if not fs.exists(path) then
- error("Folder does not exist")
- end
- fsredirectPath = path
- end
- -- Replacing old api.
- _G.fs.list = function(path)
- return fsapi.list(fsredirectPath .. path)
- end
- _G.fs.exists = function(path)
- return fsapi.exists(fsredirectPath .. path)
- end
- _G.fs.isDir = function(path)
- return fsapi.isDir(fsredirectPath .. path)
- end
- _G.fs.isReadOnly = function(path)
- return fsapi.isReadOnly(fsredirectPath .. path)
- end
- _G.fs.getDir = function(path)
- return fsapi.getDir(fsredirectPath .. path)
- end
- _G.fs.getName = function(path)
- return fsapi.getName(fsredirectPath .. path)
- end
- _G.fs.getSize = function(path)
- return fsapi.getSize(fsredirectPath .. path)
- end
- _G.fs.getDrive = function(path)
- return fsapi.getDrive(fsredirectPath .. path)
- end
- _G.fs.getFreeSpace = function(path)
- return fsapi.getFreeSpace(fsredirectPath .. path)
- end
- _G.fs.makeDir = function(path)
- return fsapi.makeDir(fsredirectPath .. path)
- end
- _G.fs.move = function(patha,pathb)
- return fsapi.move(fsredirectPath .. patha,fsredirectPath .. pathb)
- end
- _G.fs.copy = function(patha,pathb)
- return fsapi.copy(fsredirectPath .. patha,fsredirectPath .. pathb)
- end
- _G.fs.delete = function(path)
- return fsapi.delete(fsredirectPath .. path)
- end
- _G.fs.combine = function(path,localpath)
- return fsapi.combine(fsredirectPath .. path,fsredirectPath .. localpath)
- end
- _G.fs.open = function(path,mode)
- return fsapi.combine(fsredirectPath .. path,mode)
- end
- _G.fs.complete = function(path,location)
- return fsapi.complete(fsredirectPath .. path,location)
- end
- _G.fs.restore = function()
- _G.fs = fsapi
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement