refactor(cache): use vim.fs.joinpath for constructing cache script path
This commit is contained in:
@@ -4,8 +4,10 @@
|
|||||||
|
|
||||||
local M = {}
|
local M = {}
|
||||||
|
|
||||||
|
-- Path to the cache script
|
||||||
local config_dir = vim.fn.stdpath("config")
|
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
|
-- Flag to check if the script has already been run
|
||||||
local script_run_once = false
|
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 to run the cache update script using vim.system
|
||||||
function M.setup_script()
|
function M.setup_script()
|
||||||
if not script_run_once then
|
if not script_run_once then
|
||||||
|
-- Run the cache script
|
||||||
vim.system({ cache_script }, { detach = true }, function() end)
|
vim.system({ cache_script }, { detach = true }, function() end)
|
||||||
|
-- Prevent the script from running again
|
||||||
script_run_once = true
|
script_run_once = true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user