From 9719ee2ce0babcd3c36654f9314448996133b255 Mon Sep 17 00:00:00 2001 From: "Scott E. Graves" Date: Tue, 6 Sep 2022 09:45:08 -0500 Subject: [PATCH] refactoring --- lua/nvim-haven/init.lua | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/lua/nvim-haven/init.lua b/lua/nvim-haven/init.lua index 7204db2..9e03b7e 100644 --- a/lua/nvim-haven/init.lua +++ b/lua/nvim-haven/init.lua @@ -583,14 +583,14 @@ M.clean = function() ) end - local files = scan.scan_dir(haven_config.haven_path, {hidden = true, depth = 1}) - for _, name in ipairs(files) do - local original_path = Path:new(name) - name = decode(Path:new(name):make_relative(haven_config.haven_path)):sub(1, -6) - local p = Path:new(name) - if not p:exists() then - print("removing: " .. original_path:absolute()) - original_path:rm() + local history_files = scan.scan_dir(haven_config.haven_path, {hidden = true, depth = 1}) + for _, history_file in ipairs(history_files) do + local source_path = + Path:new(decode(Path:new(history_file):make_relative(haven_config.haven_path)):sub(1, -6)) + if not source_path:exists() then + local history_path = Path:new(history_file) + print("removing: " .. history_path:absolute()) + history_path:rm() end end end