From 3376717f6efee623302f38f905e857d8ff1123b2 Mon Sep 17 00:00:00 2001 From: Ale32bit Date: Wed, 23 Sep 2015 14:04:24 +0200 Subject: [PATCH] Update sPhone.lua --- src/sPhone.lua | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/src/sPhone.lua b/src/sPhone.lua index 76d2c28..24f71eb 100644 --- a/src/sPhone.lua +++ b/src/sPhone.lua @@ -47,7 +47,21 @@ local function kernel() end for k, v in pairs(fs.list("/.sPhone/autorun")) do - dofile("/.sPhone/autorun/"..v) + if not fs.isDir("/.sPhone/autorun/"..v) then + local f = fs.open("/.sPhone/autorun/"..v,"r") + local script = f.readAll() + f.close() + print("Loading script "..v) + sleep(0) + local ok, err = pcall(function() setfenv(loadstring(script),getfenv())() end) + if not ok then + printError("Script error: "..v..": "..err) + fs.move("/.sPhone/autorun/"..v, "/.sPhone/autorun/disabled/"..v) + printError(v.." disabled to prevent errors") + end + + + end end if runningOnStartup then