gracefully handle a read-only config file location

This commit is contained in:
Izaya 2023-10-11 12:38:47 +10:00
parent 36c6859abf
commit f87191c4ae

View File

@ -50,5 +50,10 @@ f:close()
print("\nDone! Saving config...") print("\nDone! Saving config...")
local f = io.open(cfgpath, "wb") local f = io.open(cfgpath, "wb")
f:write(serial.serialize(config)) if f then
f:close() f:write(serial.serialize(config))
f:close()
else
print("Failed to save config. Lost contents:")
print(serial.serialize(config))
end