From c20af3074ce5e59a9c5761279b3b458ba4aa2689 Mon Sep 17 00:00:00 2001 From: Markus Ast Date: Sat, 16 Nov 2019 17:16:03 +0100 Subject: [PATCH] properly create new scratchpad on first use Refs #7 --- Scripts/Hooks/scratchpad-hook.lua | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/Scripts/Hooks/scratchpad-hook.lua b/Scripts/Hooks/scratchpad-hook.lua index 69b30b1..bc919f6 100644 --- a/Scripts/Hooks/scratchpad-hook.lua +++ b/Scripts/Hooks/scratchpad-hook.lua @@ -255,6 +255,20 @@ function scratchpad_load() end end end + + -- there are no pages yet, create one + if pagesCount == 0 then + path = dirPath .. [[0000.txt]] + scratchpad.log("creating page " .. path) + table.insert( + pages, + { + name = "0000", + path = path + } + ) + pagesCount = pagesCount + 1 + end end function scratchpad.saveConfiguration()