Commit c8162ae8 authored by Martin's avatar Martin

Update openTODO.lua

parent 236dfe62
-- OpenTODO
-- A simple program that lets you keep a list of TODO's with checkboxes next to them
-- Allows adding/deleting entries, checking/unchecking entries
-- Saves entries to file on quit and reads on start
......@@ -9,8 +10,11 @@ local cereal = require("serialization")
local gpu = c.gpu
local color = require("colors")
local event = require("event")
local fs = require("filesystem")
local file = io.open("todo","r")
fs.makeDirectory("/usr/share/opentodo/")
local file = io.open("/usr/share/opentodo/save.tbl","r")
local entries
if file ~= nil then
local contents = file:read("*a")
......@@ -19,10 +23,10 @@ if file ~= nil then
else
entries = {}
end
file:close()
else
entries = {}
end
file:close()
local selected = 1
local function count(table)
......@@ -116,9 +120,9 @@ end
term.clear()
local file = io.open("todo","w")
local file = io.open("/usr/share/opentodo/save.tbl","w")
if file == nil then
error("Couldn't open file 'todo'")
error("Couldn't open file '/usr/share/opentodo/save.tbl'")
end
local cerealEntries = cereal.serialize(entries)
local result, message = file:write(cerealEntries)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment