diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2022-05-05 17:15:56 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2022-05-05 17:15:56 +0800 |
commit | 76d465165c0627cdadd9a1fe321ab39bb4a118a5 (patch) | |
tree | 00d9f7d3727c3e2b4dffb883c0ae69c9b27c43d4 /script/fs-utility.lua | |
parent | 5d5a79fd52c2898bb3e238e750347d8ed9f4da6a (diff) | |
download | lua-language-server-76d465165c0627cdadd9a1fe321ab39bb4a118a5.zip |
dont scan symbol links
Diffstat (limited to 'script/fs-utility.lua')
-rw-r--r-- | script/fs-utility.lua | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/script/fs-utility.lua b/script/fs-utility.lua index c845c769..08aae98a 100644 --- a/script/fs-utility.lua +++ b/script/fs-utility.lua @@ -281,12 +281,8 @@ local function fsIsDirectory(path, option) if path.type == 'dummy' then return path:isDirectory() end - local suc, res = pcall(fs.is_directory, path) - if not suc then - option.err[#option.err+1] = res - return false - end - return res + local status = fs.symlink_status(path):type() + return status == 'directory' end local function fsPairs(path, option) @@ -616,9 +612,10 @@ end function m.scanDirectory(dir, callback) for fullpath in fs.pairs(dir) do - if fs.is_directory(fullpath) then + local status = fs.symlink_status(fullpath):type() + if status == 'directory' then m.scanDirectory(fullpath, callback) - else + elseif status == 'regular' then callback(fullpath) end end |