diff options
| author | William Boman <william@redwill.se> | 2026-05-28 11:04:19 +0200 |
|---|---|---|
| committer | William Boman <william@redwill.se> | 2026-05-28 11:05:11 +0200 |
| commit | 628d82d6c2ea0f1f3f55b692f8a6b020376a1bd9 (patch) | |
| tree | 4172161d9a72fe41b0331259835c24ce6542f923 /lua/mason-core/fs.lua | |
| parent | refactor(fs): use fs.ls in readdir implementation (diff) | |
| download | mason-fix/rmrf-libuv.tar mason-fix/rmrf-libuv.tar.gz mason-fix/rmrf-libuv.tar.bz2 mason-fix/rmrf-libuv.tar.lz mason-fix/rmrf-libuv.tar.xz mason-fix/rmrf-libuv.tar.zst mason-fix/rmrf-libuv.zip | |
refactor(fs): use stat instead of fstatfix/rmrf-libuv
Diffstat (limited to 'lua/mason-core/fs.lua')
| -rw-r--r-- | lua/mason-core/fs.lua | 17 |
1 files changed, 7 insertions, 10 deletions
diff --git a/lua/mason-core/fs.lua b/lua/mason-core/fs.lua index 0185c30e..2f620a49 100644 --- a/lua/mason-core/fs.lua +++ b/lua/mason-core/fs.lua @@ -7,32 +7,29 @@ local function make_module(uv) local M = {} ---@param path string - function M.fstat(path) - log.trace("fs: fstat", path) - local fd = uv.fs_open(path, "r", 438) - local fstat = uv.fs_fstat(fd) - uv.fs_close(fd) - return fstat + function M.stat(path) + log.trace("fs: stat", path) + return assert(uv.fs_stat(path)) end ---@param path string function M.file_exists(path) log.trace("fs: file_exists", path) - local ok, fstat = pcall(M.fstat, path) + local ok, stat = pcall(M.stat, path) if not ok then return false end - return fstat.type == "file" + return stat.type == "file" end ---@param path string function M.dir_exists(path) log.trace("fs: dir_exists", path) - local ok, fstat = pcall(M.fstat, path) + local ok, stat = pcall(M.stat, path) if not ok then return false end - return fstat.type == "directory" + return stat.type == "directory" end ---@param path string |
