From 2326e70adc335174437580e9a413e5911b637d1f Mon Sep 17 00:00:00 2001 From: IgorTimofeev Date: Sat, 1 Jan 2022 19:41:51 +0700 Subject: [PATCH] =?UTF-8?q?=D0=A5=D1=83=D0=B9=20=D0=B7=D0=BD=D0=B0=D0=B5?= =?UTF-8?q?=D1=82,=20=D1=87=D0=B5=20=D1=8D=D1=82=D0=BE=20=D0=B7=D0=B0=20?= =?UTF-8?q?=D0=BC=D0=B8=D0=BA=D1=80=D0=BE-=D0=BF=D1=80=D0=B0=D0=B2=D0=BA?= =?UTF-8?q?=D0=B8,=20=D0=BD=D0=B0=20=D0=BD=D0=BE=D1=83=D1=82=D0=B5=20?= =?UTF-8?q?=D1=81=D1=82=D0=B0=D1=80=D0=BE=D0=BC=20=D0=BD=D0=B0=D1=88=D0=B5?= =?UTF-8?q?=D0=BB=20=D0=BD=D0=B5=D0=B7=D0=B0=D0=BA=D0=BE=D0=BC=D0=B8=D1=87?= =?UTF-8?q?=D0=B5=D0=BD=D0=BD=D1=83=D1=8E=20=D1=80=D0=B5=D0=BF=D1=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- OS.lua | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/OS.lua b/OS.lua index d0cbdb5b..69e102f4 100644 --- a/OS.lua +++ b/OS.lua @@ -7,10 +7,13 @@ local bootFilesystemProxy = component.proxy(component.proxy(component.list("eepr -- Executes file from boot HDD during OS initialization (will be overriden in filesystem library later) function dofile(path) local stream, reason = bootFilesystemProxy.open(path, "r") + if stream then local data, chunk = "" + while true do chunk = bootFilesystemProxy.read(stream, math.huge) + if chunk then data = data .. chunk else @@ -21,6 +24,7 @@ function dofile(path) bootFilesystemProxy.close(stream) local result, reason = load(data, "=" .. path) + if result then return result() else @@ -41,9 +45,7 @@ package = { } -- Checks existense of specified path. It will be overriden after filesystem library initialization -local function requireExists(path) - return bootFilesystemProxy.exists(path) -end +local requireExists = bootFilesystemProxy.exists -- Works the similar way as native Lua require() function function require(module) @@ -133,10 +135,8 @@ local filesystem = UIRequire("Filesystem") -- Setting main filesystem proxy to what are we booting from filesystem.setProxy(bootFilesystemProxy) --- Redeclaring requireExists function after filesystem library initialization -requireExists = function(variant) - return filesystem.exists(variant) -end +-- Replacing requireExists function after filesystem library initialization +requireExists = filesystem.exists -- Loading other libraries UIRequire("Component") @@ -202,6 +202,7 @@ event.addHandler( else if not GPUProxy.getScreen() then local address = component.list("screen")() + if address then bindScreen(address) end @@ -217,6 +218,7 @@ system.authorize() -- Main loop with UI regeneration after errors while true do local success, path, line, traceback = system.call(workspace.start, workspace, 0) + if success then break else