mirror of
https://github.com/IgorTimofeev/MineOS.git
synced 2026-09-14 11:06:16 +05:00
aefaef
This commit is contained in:
parent
9b7dedf387
commit
5e2ef32bec
@ -115,28 +115,6 @@ local function download(url, path)
|
||||
end
|
||||
end
|
||||
|
||||
local function dofile(path, ...)
|
||||
local handle, reason = selectedFilesystemProxy.open(path, "rb")
|
||||
if handle then
|
||||
local data, chunk = ""
|
||||
while true do
|
||||
chunk = selectedFilesystemProxy.read(handle, math.huge)
|
||||
|
||||
if chunk then
|
||||
data = data .. chunk
|
||||
else
|
||||
break
|
||||
end
|
||||
end
|
||||
|
||||
selectedFilesystemProxy.close(handle)
|
||||
|
||||
return load(data, "=" .. path)(...)
|
||||
end
|
||||
|
||||
error("File opening failed: " .. tostring(reason))
|
||||
end
|
||||
|
||||
local function deserialize(text)
|
||||
local result, reason = load("return " .. text, "=string")
|
||||
if result then
|
||||
@ -187,7 +165,22 @@ function require(module)
|
||||
error("already loading " .. module .. ": " .. debug.traceback())
|
||||
else
|
||||
package.loading[module] = true
|
||||
package.loaded[module] = dofile(installerPath .. "Libraries/" .. module .. ".lua")
|
||||
|
||||
local path = installerPath .. "Libraries/" .. module .. ".lua"
|
||||
local handle, reason = temporaryFilesystemProxy.open(path, "rb")
|
||||
if handle then
|
||||
local data, chunk = ""
|
||||
repeat
|
||||
chunk = temporaryFilesystemProxy.read(handle, math.huge)
|
||||
data = data .. (chunk or "")
|
||||
until not chunk
|
||||
temporaryFilesystemProxy.close(handle)
|
||||
|
||||
package.loaded[module] = load(data, "=" .. path)() or true
|
||||
else
|
||||
error("File opening failed: " .. tostring(reason))
|
||||
end
|
||||
|
||||
package.loading[module] = nil
|
||||
|
||||
return package.loaded[module]
|
||||
@ -530,7 +523,6 @@ addStage(function()
|
||||
-- Switching back to temporary fileystem proxy
|
||||
filesystem.setProxy(temporaryFilesystemProxy)
|
||||
|
||||
|
||||
-- Flashing EEPROM
|
||||
layout:removeChildren()
|
||||
addImage(1, 1, "EEPROM")
|
||||
|
||||
Loading…
Reference in New Issue
Block a user