diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2020-12-16 16:54:05 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2020-12-16 16:54:05 +0800 |
commit | 143424062920433c7e3994248dfc5d935c337de0 (patch) | |
tree | ec0b0a427776bed2956d598e849e8b04dfc8efae /script/workspace | |
parent | 19dcd9a83dee0a641a9c2bf8326626c47c66b27d (diff) | |
download | lua-language-server-143424062920433c7e3994248dfc5d935c337de0.zip |
#306 fix scan workspace may fails
Diffstat (limited to 'script/workspace')
-rw-r--r-- | script/workspace/workspace.lua | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/script/workspace/workspace.lua b/script/workspace/workspace.lua index c76eec55..10e4b2c9 100644 --- a/script/workspace/workspace.lua +++ b/script/workspace/workspace.lua @@ -37,11 +37,15 @@ end local function interfaceFactory(root) return { type = function (path) - if fs.is_directory(fs.path(root .. '/' .. path)) then - return 'directory' - else - return 'file' - end + local result + pcall(function () + if fs.is_directory(fs.path(root .. '/' .. path)) then + result = 'directory' + else + result = 'file' + end + end) + return result end, list = function (path) local fullPath = fs.path(root .. '/' .. path) |