Skip to content

Commit 1fadbf5

Browse files
author
sunlin
authored
[main.lua] fix empty rootPath cause try "/log" folder
When run follow command with get error message, ``` $ bin/Linux/lua-language-server -E main.lua bin/Linux/lua-language-server: filesystem error: cannot create directories: Permission denied [/log] ``` Which is caused by empty `rootPath' and the folder path for log with be `/log' in follow line, https://github.com/sumneko/lua-language-server/blob/1458139721646236406825a03a21152d98753515/main.lua#L40 This change try to assign a default value `"."' for `rootPath' will fix the error.
1 parent 1458139 commit 1fadbf5

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

Diff for: main.lua

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
local currentPath = debug.getinfo(1, 'S').source:sub(2)
22
local rootPath = currentPath:gsub('[/\\]*[^/\\]-$', '')
3-
loadfile((rootPath == '' and '.' or rootPath) .. '/platform.lua')('script')
3+
rootPath = (rootPath == '' and '.' or rootPath)
4+
loadfile(rootPath .. '/platform.lua')('script')
45
local fs = require 'bee.filesystem'
56

67
local function expanduser(path)

0 commit comments

Comments
 (0)