From f2f517d0c80f1a89629bf68fc550e53070fc8da8 Mon Sep 17 00:00:00 2001 From: Sleepful Date: Wed, 5 Jul 2023 22:34:48 -0600 Subject: [PATCH] Create subdirs when creating new note previously it failed with error message --- lua/telekasten.lua | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lua/telekasten.lua b/lua/telekasten.lua index 4851ac3..5379bed 100644 --- a/lua/telekasten.lua +++ b/lua/telekasten.lua @@ -448,7 +448,13 @@ local function create_note_from_template( end -- now write the output file, substituting vars line by line + local filedir = title:match("(.*/)") or "" + local dir_succeed = check_dir_and_ask(filedir, filedir) + if dir_succeed == false then + return + end local ofile = io.open(filepath, "a") + for _, line in pairs(lines) do ofile:write( templates.subst_templated_values(