Attempting to rename all files without breaking
This commit is contained in:
parent
1937b0ef79
commit
f48288f1a3
6 changed files with 707 additions and 734 deletions
|
@ -83,7 +83,7 @@ function convert(cfgfile)
|
||||||
for _, v in pairs(lines) do
|
for _, v in pairs(lines) do
|
||||||
local tmp
|
local tmp
|
||||||
local tmp2 = ""
|
local tmp2 = ""
|
||||||
for match in string.gmatch(v, "[^\=]+") do
|
for match in string.gmatch(v, "[^\\=]+") do
|
||||||
if tmp then
|
if tmp then
|
||||||
tmp2 = tmp2..match
|
tmp2 = tmp2..match
|
||||||
else
|
else
|
||||||
|
|
53
src/init.lua
53
src/init.lua
|
@ -18,38 +18,21 @@ local function crash(err)
|
||||||
|
|
||||||
print("sPhone got an error :(\n")
|
print("sPhone got an error :(\n")
|
||||||
term.setTextColor(colors.red)
|
term.setTextColor(colors.red)
|
||||||
print(err)
|
print(debug.traceback(err))
|
||||||
term.setTextColor(colors.black)
|
term.setTextColor(colors.black)
|
||||||
print("")
|
print("")
|
||||||
if sPhone.version then
|
if sPhone.version then
|
||||||
print("sPhone " .. sPhone.version)
|
print("sPhone " .. sPhone.version)
|
||||||
end
|
end
|
||||||
print("Computer ID: "..os.getComputerID())
|
|
||||||
if _CC_VERSION then
|
|
||||||
print("CC Version: ".._CC_VERSION)
|
|
||||||
print("MC Version: ".._MC_VERSION)
|
|
||||||
elseif _HOST then
|
|
||||||
print("Host: ".._HOST)
|
|
||||||
else
|
|
||||||
print("CC Version: Under 1.74")
|
|
||||||
print("MC Version: Undefined")
|
|
||||||
term.setTextColor(colors.red)
|
|
||||||
print("Update CC to 1.74 or higher")
|
|
||||||
term.setTextColor(colors.black)
|
|
||||||
end
|
|
||||||
print("LUA Version: ".._VERSION)
|
|
||||||
if _LUAJ_VERSION then
|
|
||||||
print("LUAJ Version: ".._LUAJ_VERSION)
|
|
||||||
end
|
|
||||||
print("Contact sPhone devs:")
|
|
||||||
print("GitHub: SertexTeam/sPhone")
|
|
||||||
print("Thanks for using sPhone")
|
|
||||||
print("Press any key")
|
print("Press any key")
|
||||||
repeat
|
repeat
|
||||||
sleep(0)
|
sleep(0)
|
||||||
until os.pullEvent("key")
|
until os.pullEvent("key")
|
||||||
if not sPhone.devMode then
|
if not sPhone.devMode then
|
||||||
_G.term = nil
|
os.reboot()
|
||||||
end
|
end
|
||||||
term.setBackgroundColor(colors.black)
|
term.setBackgroundColor(colors.black)
|
||||||
term.clear()
|
term.clear()
|
||||||
|
@ -90,9 +73,13 @@ local function recovery()
|
||||||
end
|
end
|
||||||
print("Installing sPhone...")
|
print("Installing sPhone...")
|
||||||
sleep(0.5)
|
sleep(0.5)
|
||||||
setfenv(loadstring(http.get("https://raw.githubusercontent.com/SertexTeam/sPhone/master/src/installer.lua").readAll()),getfenv())()
|
setfenv(
|
||||||
|
loadstring(http.get("https://raw.githubusercontent.com/SertexTeam/sPhone/master/src/installer.lua").readAll()),
|
||||||
|
getfenv())()
|
||||||
elseif k == 3 then
|
elseif k == 3 then
|
||||||
setfenv(loadstring(http.get("https://raw.githubusercontent.com/SertexTeam/sPhone/master/src/installer.lua").readAll()),getfenv())()
|
setfenv(
|
||||||
|
loadstring(http.get("https://raw.githubusercontent.com/SertexTeam/sPhone/master/src/installer.lua").readAll()),
|
||||||
|
getfenv())()
|
||||||
elseif k == 4 then
|
elseif k == 4 then
|
||||||
fs.delete("/.sPhone/config")
|
fs.delete("/.sPhone/config")
|
||||||
fs.delete("/.sPhone/cache")
|
fs.delete("/.sPhone/cache")
|
||||||
|
@ -179,19 +166,25 @@ end
|
||||||
|
|
||||||
if argData["-u"] then
|
if argData["-u"] then
|
||||||
print("Getting installer...")
|
print("Getting installer...")
|
||||||
setfenv(loadstring(http.get("https://raw.githubusercontent.com/SertexTeam/sPhone/master/src/installer.lua").readAll()),getfenv())()
|
|
||||||
|
--setfenv(loadstring(http.get("https://raw.githubusercontent.com/SertexTeam/sPhone/master/src/installer.lua").readAll()),_ENV)()
|
||||||
end
|
end
|
||||||
|
|
||||||
os.pullEvent = os.oldPullEvent
|
os.pullEvent = os.oldPullEvent
|
||||||
|
|
||||||
local ok, err = pcall(function()
|
local func, err = loadfile("/.sPhone/sPhone.lua", "t", setmetatable({
|
||||||
setfenv(loadfile("/.sPhone/sPhone"), setmetatable({
|
|
||||||
crash = crash,
|
crash = crash,
|
||||||
safemode = safemode,
|
safemode = safemode,
|
||||||
}, {__index = getfenv()}))()
|
}, { __index = _ENV }))
|
||||||
end)
|
|
||||||
|
|
||||||
|
if not func then
|
||||||
|
crash(err)
|
||||||
|
os.shutdown()
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
local ok, err = pcall(func)
|
||||||
if not ok then
|
if not ok then
|
||||||
crash(err)
|
crash(err)
|
||||||
end
|
end
|
||||||
_G.term = nil -- The OS ends here - This string force to crash the pda to shutdown
|
os.shutdown()
|
||||||
|
|
|
@ -7,29 +7,29 @@ local old = os.pullEvent
|
||||||
os.pullEvent = os.pullEventRaw
|
os.pullEvent = os.pullEventRaw
|
||||||
|
|
||||||
local files = {
|
local files = {
|
||||||
["src/init.lua"] = "/.sPhone/init",
|
["src/init.lua"] = "/.sPhone/init.lua",
|
||||||
["src/sPhone.lua"] = "/.sPhone/sPhone",
|
["src/sPhone.lua"] = "/.sPhone/sPhone.lua",
|
||||||
|
|
||||||
["install.lua"] = "/.sPhone/update",
|
["install.lua"] = "/.sPhone/update.lua",
|
||||||
|
|
||||||
["LICENSE"] = "/.sPhone/LICENSE",
|
["LICENSE"] = "/.sPhone/LICENSE",
|
||||||
|
|
||||||
["src/apis/sha256.lua"] = "/.sPhone/apis/sha256",
|
["src/apis/sha256.lua"] = "/.sPhone/apis/sha256.lua",
|
||||||
["src/apis/visum.lua"] = "/.sPhone/apis/visum",
|
["src/apis/visum.lua"] = "/.sPhone/apis/visum.lua",
|
||||||
["src/apis/base64.lua"] = "/.sPhone/apis/base64",
|
["src/apis/base64.lua"] = "/.sPhone/apis/base64.lua",
|
||||||
["src/apis/config.lua"] = "/.sPhone/apis/config",
|
["src/apis/config.lua"] = "/.sPhone/apis/config.lua",
|
||||||
["src/apis/task.lua"] = "/.sPhone/apis/task",
|
["src/apis/task.lua"] = "/.sPhone/apis/task.lua",
|
||||||
["src/apis/temp.lua"] = "/.sPhone/apis/temp",
|
["src/apis/temp.lua"] = "/.sPhone/apis/temp.lua",
|
||||||
["src/apis/aes.lua"] = "/.sPhone/apis/aes",
|
["src/apis/aes.lua"] = "/.sPhone/apis/aes.lua",
|
||||||
["src/apis/bigfont.lua"] = "/.sPhone/apis/bigfont",
|
["src/apis/bigfont.lua"] = "/.sPhone/apis/bigfont.lua",
|
||||||
|
|
||||||
["src/bin/wget.lua"] = "/bin/wget",
|
["src/bin/wget.lua"] = "/bin/wget.lua",
|
||||||
["src/bin/halt.lua"] = "/bin/halt",
|
["src/bin/halt.lua"] = "/bin/halt.lua",
|
||||||
["src/bin/echo.lua"] = "/bin/echo",
|
["src/bin/echo.lua"] = "/bin/echo.lua",
|
||||||
|
|
||||||
["src/sdk/build.lua"] = "/bin/build",
|
["src/sdk/build.lua"] = "/bin/build.lua",
|
||||||
|
|
||||||
["src/system/vfs.lua"] = "/.sPhone/system/vfs",
|
["src/system/vfs.lua"] = "/.sPhone/system/vfs.lua",
|
||||||
|
|
||||||
["src/apps/spks/appList.spk"] = "/.sPhone/apps/system/appList.spk",
|
["src/apps/spks/appList.spk"] = "/.sPhone/apps/system/appList.spk",
|
||||||
["src/apps/spks/chat.spk"] = "/.sPhone/apps/system/chat.spk",
|
["src/apps/spks/chat.spk"] = "/.sPhone/apps/system/chat.spk",
|
||||||
|
|
|
@ -472,7 +472,6 @@ local function kernel(...)
|
||||||
nPos = nPos + 1
|
nPos = nPos + 1
|
||||||
recomplete()
|
recomplete()
|
||||||
redraw()
|
redraw()
|
||||||
|
|
||||||
elseif sEvent == "paste" then
|
elseif sEvent == "paste" then
|
||||||
-- Pasted text
|
-- Pasted text
|
||||||
clear()
|
clear()
|
||||||
|
@ -480,7 +479,6 @@ local function kernel(...)
|
||||||
nPos = nPos + string.len(param)
|
nPos = nPos + string.len(param)
|
||||||
recomplete()
|
recomplete()
|
||||||
redraw()
|
redraw()
|
||||||
|
|
||||||
elseif sEvent == "key" then
|
elseif sEvent == "key" then
|
||||||
if param == keys.enter then
|
if param == keys.enter then
|
||||||
-- Enter
|
-- Enter
|
||||||
|
@ -490,7 +488,6 @@ local function kernel(...)
|
||||||
redraw()
|
redraw()
|
||||||
end
|
end
|
||||||
break
|
break
|
||||||
|
|
||||||
elseif param == keys.left then
|
elseif param == keys.left then
|
||||||
-- Left
|
-- Left
|
||||||
if nPos > 0 then
|
if nPos > 0 then
|
||||||
|
@ -499,7 +496,6 @@ local function kernel(...)
|
||||||
recomplete()
|
recomplete()
|
||||||
redraw()
|
redraw()
|
||||||
end
|
end
|
||||||
|
|
||||||
elseif param == keys.right then
|
elseif param == keys.right then
|
||||||
-- Right
|
-- Right
|
||||||
if nPos < string.len(sLine) then
|
if nPos < string.len(sLine) then
|
||||||
|
@ -512,7 +508,6 @@ local function kernel(...)
|
||||||
-- Accept autocomplete
|
-- Accept autocomplete
|
||||||
acceptCompletion()
|
acceptCompletion()
|
||||||
end
|
end
|
||||||
|
|
||||||
elseif param == keys.up or param == keys.down then
|
elseif param == keys.up or param == keys.down then
|
||||||
-- Up or down
|
-- Up or down
|
||||||
if nCompletion then
|
if nCompletion then
|
||||||
|
@ -530,7 +525,6 @@ local function kernel(...)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
redraw()
|
redraw()
|
||||||
|
|
||||||
elseif _tHistory then
|
elseif _tHistory then
|
||||||
-- Cycle history
|
-- Cycle history
|
||||||
clear()
|
clear()
|
||||||
|
@ -560,9 +554,7 @@ local function kernel(...)
|
||||||
end
|
end
|
||||||
uncomplete()
|
uncomplete()
|
||||||
redraw()
|
redraw()
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
elseif param == keys.backspace then
|
elseif param == keys.backspace then
|
||||||
-- Backspace
|
-- Backspace
|
||||||
if nPos > 0 then
|
if nPos > 0 then
|
||||||
|
@ -572,7 +564,6 @@ local function kernel(...)
|
||||||
recomplete()
|
recomplete()
|
||||||
redraw()
|
redraw()
|
||||||
end
|
end
|
||||||
|
|
||||||
elseif param == keys.home then
|
elseif param == keys.home then
|
||||||
-- Home
|
-- Home
|
||||||
if nPos > 0 then
|
if nPos > 0 then
|
||||||
|
@ -581,7 +572,6 @@ local function kernel(...)
|
||||||
recomplete()
|
recomplete()
|
||||||
redraw()
|
redraw()
|
||||||
end
|
end
|
||||||
|
|
||||||
elseif param == keys.delete then
|
elseif param == keys.delete then
|
||||||
-- Delete
|
-- Delete
|
||||||
if nPos < string.len(sLine) then
|
if nPos < string.len(sLine) then
|
||||||
|
@ -590,7 +580,6 @@ local function kernel(...)
|
||||||
recomplete()
|
recomplete()
|
||||||
redraw()
|
redraw()
|
||||||
end
|
end
|
||||||
|
|
||||||
elseif param == keys["end"] then
|
elseif param == keys["end"] then
|
||||||
-- End
|
-- End
|
||||||
if nPos < string.len(sLine) then
|
if nPos < string.len(sLine) then
|
||||||
|
@ -599,18 +588,14 @@ local function kernel(...)
|
||||||
recomplete()
|
recomplete()
|
||||||
redraw()
|
redraw()
|
||||||
end
|
end
|
||||||
|
|
||||||
elseif param == keys.tab then
|
elseif param == keys.tab then
|
||||||
-- Tab (accept autocomplete)
|
-- Tab (accept autocomplete)
|
||||||
acceptCompletion()
|
acceptCompletion()
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
elseif sEvent == "term_resize" then
|
elseif sEvent == "term_resize" then
|
||||||
-- Terminal resized
|
-- Terminal resized
|
||||||
w = term.getSize()
|
w = term.getSize()
|
||||||
redraw()
|
redraw()
|
||||||
|
|
||||||
elseif sEvent == "mouse_click" and _MouseEvent then
|
elseif sEvent == "mouse_click" and _MouseEvent then
|
||||||
if nCompletion then
|
if nCompletion then
|
||||||
clear()
|
clear()
|
||||||
|
@ -689,7 +674,6 @@ local function kernel(...)
|
||||||
end
|
end
|
||||||
|
|
||||||
function sPhone.header(title, butt)
|
function sPhone.header(title, butt)
|
||||||
|
|
||||||
if not title then
|
if not title then
|
||||||
title = "sPhone"
|
title = "sPhone"
|
||||||
end
|
end
|
||||||
|
@ -1092,7 +1076,8 @@ end
|
||||||
|
|
||||||
local result = {}
|
local result = {}
|
||||||
local ok, err = pcall(function()
|
local ok, err = pcall(function()
|
||||||
result = {setfenv(loadfile(fs.combine("/.sPhone/apps/spk",_config.id.."/files/".._config.main)), setmetatable({
|
result = { setfenv(loadfile(fs.combine("/.sPhone/apps/spk", _config.id .. "/files/" .. _config.main)),
|
||||||
|
setmetatable({
|
||||||
spk = {
|
spk = {
|
||||||
getName = function()
|
getName = function()
|
||||||
return (_config.name or nil)
|
return (_config.name or nil)
|
||||||
|
@ -1146,8 +1131,6 @@ end
|
||||||
"sphone.home",
|
"sphone.home",
|
||||||
}
|
}
|
||||||
while true do
|
while true do
|
||||||
|
|
||||||
|
|
||||||
if not config.read("/.sPhone/config/spklist", "sphone.home") then
|
if not config.read("/.sPhone/config/spklist", "sphone.home") then
|
||||||
sPhone.install("/.sPhone/apps/home.spk")
|
sPhone.install("/.sPhone/apps/home.spk")
|
||||||
end
|
end
|
||||||
|
@ -1178,7 +1161,6 @@ end
|
||||||
errorCount = errorCount + 1
|
errorCount = errorCount + 1
|
||||||
end
|
end
|
||||||
sleep(0)
|
sleep(0)
|
||||||
|
|
||||||
end
|
end
|
||||||
sPhone.inHome = false
|
sPhone.inHome = false
|
||||||
end
|
end
|
||||||
|
@ -1267,7 +1249,6 @@ end
|
||||||
end
|
end
|
||||||
|
|
||||||
while not skipped do
|
while not skipped do
|
||||||
|
|
||||||
term.setBackgroundColor(sPhone.theme["lock.background"])
|
term.setBackgroundColor(sPhone.theme["lock.background"])
|
||||||
term.clear()
|
term.clear()
|
||||||
term.setCursorPos(1, 1)
|
term.setCursorPos(1, 1)
|
||||||
|
@ -1410,7 +1391,6 @@ end
|
||||||
sPhone.winOk("New Update:", newVersion)
|
sPhone.winOk("New Update:", newVersion)
|
||||||
end
|
end
|
||||||
home()
|
home()
|
||||||
|
|
||||||
end
|
end
|
||||||
if not sPhone then
|
if not sPhone then
|
||||||
kernel({ ... })
|
kernel({ ... })
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
if not fs.exists("/.sPhone/init") then
|
if not fs.exists("/.sPhone/init.lua") then
|
||||||
printError("sPhone not found")
|
printError("sPhone not found")
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
shell.run("/.sPhone/init", "-s")
|
shell.run("/.sPhone/init.lua", "-s")
|
|
@ -168,7 +168,7 @@ function fs.exists(path)
|
||||||
return fs.getProxy(path).exists(fs.getProxiedPath(path))
|
return fs.getProxy(path).exists(fs.getProxiedPath(path))
|
||||||
end
|
end
|
||||||
function fs.combine(path1, path2)
|
function fs.combine(path1, path2)
|
||||||
return nativefs.combine(path1, path2)
|
return nativefs.combine(path1, path2 or "")
|
||||||
end
|
end
|
||||||
function fs.getName(path)
|
function fs.getName(path)
|
||||||
path = fs.cleanPath(path)
|
path = fs.cleanPath(path)
|
||||||
|
|
Loading…
Reference in a new issue