e
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
|
||||
local fss = {}
|
||||
local object = {}
|
||||
local uObject = {}
|
||||
@@ -119,42 +120,37 @@ function uObject:getSize()
|
||||
return #data
|
||||
end
|
||||
|
||||
local function findDisks(tble)
|
||||
function aceVM.initDisks(tble)
|
||||
for i,v in ipairs(tble) do
|
||||
if fs.exists("/disks/"..tostring(v).."h") then
|
||||
if fs.exists("/AceVM/disks/"..tostring(v).."h") then
|
||||
local obj = deepcopy(object)
|
||||
obj.__UDATA_id=v
|
||||
obj.id="disk_"..tostring(v)
|
||||
obj.type="hdd"
|
||||
newComponent("disk", obj)
|
||||
fss[tostring(v)]="/disks/"..tostring(v).."h/"
|
||||
elseif fs.exists("/disks/"..tostring(v).."f") then
|
||||
aceVM.newComponent("disk", obj)
|
||||
fss[tostring(v)]="/AceVM/disks/"..tostring(v).."h/"
|
||||
elseif fs.exists("/AceVM/disks/"..tostring(v).."f") then
|
||||
local obj = deepcopy(object)
|
||||
obj.__UDATA_id=v
|
||||
obj.id="disk_"..tostring(v)
|
||||
obj.type="fdd"
|
||||
newComponent("disk", obj)
|
||||
fss[tostring(v)]="/disks/"..tostring(v).."f/"
|
||||
elseif fs.exists("/disks/"..tostring(v).."u") then
|
||||
aceVM.newComponent("disk", obj)
|
||||
fss[tostring(v)]="/AceVM/disks/"..tostring(v).."f/"
|
||||
elseif fs.exists("/AceVM/disks/"..tostring(v).."u") then
|
||||
local obj = deepcopy(uObject)
|
||||
obj.__UDATA_id=v
|
||||
obj.id="disk_"..tostring(v)
|
||||
obj.type="udd"
|
||||
newComponent("disk", obj)
|
||||
fss[tostring(v)]="/disks/"..tostring(v).."u"
|
||||
aceVM.newComponent("disk", obj)
|
||||
fss[tostring(v)]="/AceVM/disks/"..tostring(v).."u"
|
||||
else
|
||||
fs.makeDir("/disks/"..tostring(v).."f/")
|
||||
fs.makeDir("/AceVM/disks/"..tostring(v).."f/")
|
||||
local obj = deepcopy(object)
|
||||
obj.__UDATA_id=v
|
||||
obj.id="disk_"..tostring(v)
|
||||
obj.type="fdd"
|
||||
newComponent("disk", obj)
|
||||
fss[tostring(v)]="/disks/"..tostring(v).."f/"
|
||||
aceVM.newComponent("disk", obj)
|
||||
fss[tostring(v)]="/AceVM/disks/"..tostring(v).."f/"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local file = fs.open("/computers/0/computer.ltable", "r")
|
||||
local config = load("return "..file.readAll())()
|
||||
file.close()
|
||||
findDisks(config.disks)
|
||||
end
|
||||
Reference in New Issue
Block a user