From 6ce6823643a6af4830ae884bb22a54af84e3bc39 Mon Sep 17 00:00:00 2001 From: HumblePresent <60856003+HumblePresent@users.noreply.github.com> Date: Sat, 13 Aug 2022 04:58:03 -0500 Subject: [PATCH] fix: #18 Replace directory pattern match with exact match * fix: #18 replace directory pattern match with exact match * fix: #18 properly expand directory name --- lua/persisted/utils.lua | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lua/persisted/utils.lua b/lua/persisted/utils.lua index 8f46f20..1363411 100644 --- a/lua/persisted/utils.lua +++ b/lua/persisted/utils.lua @@ -27,14 +27,14 @@ function M.get_last_item(table) end ---Check if a target directory exists in a given table ----@param dir_target string ----@param dir_table table +---@param dir string +---@param dirs_table table ---@return boolean function M.dirs_match(dir, dirs_table) - local dir = vim.fn.expand(dir) + dir = vim.fn.expand(dir) return dirs_table - and next(vim.tbl_filter(function(pattern) - return dir:match(vim.fn.expand(pattern)) + and next(vim.tbl_filter(function(dir_match) + return dir == vim.fn.expand(dir_match) end, dirs_table)) end