add helper file to deal with aliases

This commit is contained in:
2025-04-25 16:14:28 -05:00
parent 452414cafb
commit 3b7963ab0a
3 changed files with 15 additions and 8 deletions

4
lua/dep/helpers.lua Normal file
View File

@ -0,0 +1,4 @@
return {
-- vim.loop was depricated in nvim 0.10
uv = vim.uv or vim.loop
}

View File

@ -1,3 +1,5 @@
local h = require('dep.helpers')
local logger = {}
logger.stage_colors = {
@ -14,8 +16,8 @@ logger.stage_colors = {
local function default_log_path()
-- create cache directory and chmod it if it doesn't already exist
local path = vim.fn.stdpath("cache")
if not vim.loop.fs_stat(path) then
vim.loop.fs_mkdir(path, 0x1ff) -- 0777
if not h.uv.fs_stat(path) then
h.uv.fs_mkdir(path, 0x1ff) -- 0777
end
return vim.fs.normalize(path).."/dep.log"
@ -37,8 +39,8 @@ function logger:setup(path)
logger.path = path or default_log_path()
local pipe
logger.handle = assert(vim.loop.fs_open(logger.path, "w", 0x1a4)) -- 0644
pipe = vim.loop.new_pipe()
logger.handle = assert(h.uv.fs_open(logger.path, "w", 0x1a4)) -- 0644
pipe = h.uv.new_pipe()
pipe:open(logger.handle)
return pipe
@ -90,7 +92,7 @@ function logger:cleanup(pipe, handle)
pipe = nil
end
if handle then
vim.loop.fs_close(logger.handle)
h.uv.fs_close(logger.handle)
handle = nil
end
end