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
1 changed files with 7 additions and 2 deletions

View File

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