From 0650f4c430b80a2bf623611446e793c62ed046ab Mon Sep 17 00:00:00 2001 From: rootiest Date: Fri, 23 Aug 2024 10:01:01 -0400 Subject: [PATCH] refactor(cache): use vim.fs.joinpath for constructing cache script path --- lua/utils/cache_stats.lua | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lua/utils/cache_stats.lua b/lua/utils/cache_stats.lua index d9a1cc2..cb5e05c 100644 --- a/lua/utils/cache_stats.lua +++ b/lua/utils/cache_stats.lua @@ -4,8 +4,10 @@ local M = {} +-- Path to the cache script local config_dir = vim.fn.stdpath("config") -local cache_script = config_dir .. "/scripts/update_cache.sh" +---@diagnostic disable-next-line: param-type-mismatch +local cache_script = vim.fs.joinpath(config_dir, "/scripts/update_cache.sh") -- Flag to check if the script has already been run local script_run_once = false @@ -13,7 +15,9 @@ local script_run_once = false -- Function to run the cache update script using vim.system function M.setup_script() if not script_run_once then + -- Run the cache script vim.system({ cache_script }, { detach = true }, function() end) + -- Prevent the script from running again script_run_once = true end end