1
1
mirror of https://git.shadowkat.net/izaya/OC-PsychOS2.git synced 2024-11-22 12:04:20 -05:00

added fs.mounts(), fs.address(path) and fs.type(path) to provide more information about mounted filesystems

This commit is contained in:
XeonSquared 2019-11-08 21:01:01 +11:00
parent b2d1379127
commit 69eae00ec1

View File

@ -27,7 +27,7 @@ function fs.resolve(path) -- resolves *path* to a specific filesystem mount and
end end
-- generate some simple functions -- generate some simple functions
for k,v in pairs({"makeDirectory","exists","isDirectory","list","lastModified","remove","size","spaceUsed","isReadOnly","getLabel"}) do for k,v in pairs({"makeDirectory","exists","isDirectory","list","lastModified","remove","size","spaceUsed","spaceTotal","isReadOnly","getLabel"}) do
fs[v] = function(path) fs[v] = function(path)
local fsi,path = fs.resolve(path) local fsi,path = fs.resolve(path)
return fsmounts[fsi][v](path) return fsmounts[fsi][v](path)
@ -107,6 +107,23 @@ function fs.mount(path,proxy)
return false, "path is not a directory" return false, "path is not a directory"
end end
function fs.mounts()
local rt = {}
for k,v in pairs(fsmounts) do
rt[#rt+1] = k,v.address or "unknown"
end
return rt
end
function fs.address(path)
local fsi,_ = fs.resolve(path)
return fsmounts[fsi].address
end
function fs.type(path)
local fsi,_ = fs.resolve(path)
return fsmounts[fsi].type
end
fsmounts["/"] = component.proxy(computer.tmpAddress()) fsmounts["/"] = component.proxy(computer.tmpAddress())
fs.makeDirectory("temp") fs.makeDirectory("temp")
if computer.getBootAddress then if computer.getBootAddress then