From 8c48f52471bd8b5766ac1abd95b43a73162a6c39 Mon Sep 17 00:00:00 2001 From: Josha von Gizycki Date: Tue, 27 Aug 2019 21:10:06 +0200 Subject: [PATCH] fix deletion of dorodata on startup --- main.janet | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/main.janet b/main.janet index 29484a9..734fa38 100644 --- a/main.janet +++ b/main.janet @@ -55,9 +55,12 @@ entries) (defn ensure-dorodata [] - (-> (file/open dorodata :w) - (file/flush) - (file/close))) + (let [f (file/open dorodata :r)] + (if (nil? f) + (-> (file/open dorodata :w) + (file/flush) + (file/close)) + (file/close f)))) (defn load-entries [] (let [f (file/open dorodata :r)