diff --git a/src/main/resources/assets/opencomputers/loot/openos/lib/process.lua b/src/main/resources/assets/opencomputers/loot/openos/lib/process.lua index 15f362d26..1cca5e445 100644 --- a/src/main/resources/assets/opencomputers/loot/openos/lib/process.lua +++ b/src/main/resources/assets/opencomputers/loot/openos/lib/process.lua @@ -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) diff --git a/src/main/resources/assets/opencomputers/loot/openos/lib/tools/programLocations.lua b/src/main/resources/assets/opencomputers/loot/openos/lib/tools/programLocations.lua new file mode 100644 index 000000000..9772e00ea --- /dev/null +++ b/src/main/resources/assets/opencomputers/loot/openos/lib/tools/programLocations.lua @@ -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 diff --git a/src/main/scala/li/cil/oc/integration/opencomputers/ModOpenComputers.scala b/src/main/scala/li/cil/oc/integration/opencomputers/ModOpenComputers.scala index 097e93f5d..164d977bc 100644 --- a/src/main/scala/li/cil/oc/integration/opencomputers/ModOpenComputers.scala +++ b/src/main/scala/li/cil/oc/integration/opencomputers/ModOpenComputers.scala @@ -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")