better detection for the path

This commit is contained in:
Izaya 2017-05-28 17:29:23 +00:00
parent cff032643e
commit 8b2d6778dc
1 changed files with 2 additions and 3 deletions

View File

@ -1,10 +1,9 @@
if pcall(require,"computer") then if pcall(require,"computer") then
print("OpenOS detected.") print("OpenOS detected.")
print("Please note that if you didn't call this with its full name, this will not work.") print(os.getenv("_"))
print("eg: kernel.lua rather than just kernel")
local computer = require "computer" local computer = require "computer"
local process = require "process" local process = require "process"
os.execute("cp "..process.info().path.." /tmp/init.lua") os.execute("cp "..os.getenv("_").." /tmp/init.lua")
computer.setBootAddress(computer.tmpAddress()) computer.setBootAddress(computer.tmpAddress())
computer.shutdown(true) computer.shutdown(true)
end end