Merge pull request #2109 from payonel/cleanup-program-locations

wget and pastebin are now core to openos install
This commit is contained in:
payonel 2016-11-01 23:02:04 -07:00 committed by GitHub
commit dd10cd7ecc
3 changed files with 26 additions and 3 deletions

View File

@ -52,7 +52,8 @@ function process.load(path, env, init, name)
io.stderr:write(path .. ": is a directory\n")
return 126
end
io.stderr:write(path .. ": " .. reason .. "\n")
local handler = require("tools/programLocations")
handler.reportNotFound(path, reason)
return 127
end
os.setenv("_", program)

View File

@ -0,0 +1,24 @@
local computer = require("computer")
local lib = {}
function lib.locate(path)
for _,lookup in ipairs(computer.getProgramLocations()) do
if lookup[1] == path then
return lookup[2]
end
end
end
function lib.reportNotFound(path, reason)
checkArg(1, path, "string")
local loot = lib.locate(path)
if loot then
io.stderr:write("The program '" .. path .. "' is currently not installed. To install it:\n" ..
"1. Craft the '" .. loot .. "' floppy disk and insert it into this computer.\n" ..
"2. Run `install " .. loot .. "`")
elseif type(reason) == "string" then
io.stderr:write(path .. ": " .. reason .. "\n")
end
end
return lib

View File

@ -80,8 +80,6 @@ object ModOpenComputers extends ModProxy {
api.IMC.registerProgramDiskLabel("md5sum", "data", "Lua 5.2", "Lua 5.3", "LuaJ")
api.IMC.registerProgramDiskLabel("sha256sum", "data", "Lua 5.2", "Lua 5.3", "LuaJ")
api.IMC.registerProgramDiskLabel("refuel", "generator", "Lua 5.2", "Lua 5.3", "LuaJ")
api.IMC.registerProgramDiskLabel("pastebin", "internet", "Lua 5.2", "Lua 5.3", "LuaJ")
api.IMC.registerProgramDiskLabel("wget", "internet", "Lua 5.2", "Lua 5.3", "LuaJ")
api.IMC.registerProgramDiskLabel("irc", "irc", "Lua 5.2", "Lua 5.3", "LuaJ")
api.IMC.registerProgramDiskLabel("maze", "maze", "Lua 5.2", "Lua 5.3", "LuaJ")
api.IMC.registerProgramDiskLabel("arp", "network", "Lua 5.2", "Lua 5.3", "LuaJ")