hopefully support OpenOS too

This commit is contained in:
Izaya 2023-10-11 12:33:45 +10:00
parent 5dc27fd38b
commit 36c6859abf
1 changed files with 4 additions and 2 deletions

View File

@ -1,8 +1,10 @@
local serial = require "serialization"
local fs = fs or require "filesystem"
local component = require "component"
local computer = require "computer"
local diskpart = require "diskpart"
local cfgpath = (_OSVERSION or ""):sub(1,7) == "PsychOS" and "/boot/cfg/boop.cfg" or "/etc/boop.cfg"
local defaults = {
path = "/boot/init.lua",
drive = computer.getBootAddress():match("^([^/])")
@ -11,7 +13,7 @@ local defaults = {
local tA = {...}
local config = defaults
local f = io.open("/boot/cfg/boop.cfg","rb")
local f = io.open(cfgpath,"rb")
if f then
config = setmetatable(serial.unserialize(f:read("*a")), {__index=defaults})
f:close()
@ -47,6 +49,6 @@ end
f:close()
print("\nDone! Saving config...")
local f = io.open("/boot/cfg/boop.cfg", "wb")
local f = io.open(cfgpath, "wb")
f:write(serial.serialize(config))
f:close()