notes app: ensure file exists

This commit is contained in:
Michiel Borkent 2020-03-29 14:10:53 +02:00
parent 34d36d56ba
commit 22ea488666

View file

@ -12,10 +12,9 @@
(def notes-file (io/file (System/getProperty "user.home") ".notes" "notes.txt")) (def notes-file (io/file (System/getProperty "user.home") ".notes" "notes.txt"))
(io/make-parents notes-file) (io/make-parents notes-file)
;; ensure file exists
(.createNewFile notes-file)
(def file-lock (Object.)) (def file-lock (Object.))
;; ensure notes file exists
(spit notes-file "" :append true)
(defn write-note! [note] (defn write-note! [note]
(locking file-lock (locking file-lock