From 1fadbf5fb1e8b683da23635d7b229bf6fa9ba75e Mon Sep 17 00:00:00 2001 From: sunlin Date: Wed, 20 Jan 2021 17:15:31 +0800 Subject: [PATCH] [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. --- main.lua | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/main.lua b/main.lua index 1b0c7a5a3..173b5af10 100644 --- a/main.lua +++ b/main.lua @@ -1,6 +1,7 @@ local currentPath = debug.getinfo(1, 'S').source:sub(2) local rootPath = currentPath:gsub('[/\\]*[^/\\]-$', '') -loadfile((rootPath == '' and '.' or rootPath) .. '/platform.lua')('script') +rootPath = (rootPath == '' and '.' or rootPath) +loadfile(rootPath .. '/platform.lua')('script') local fs = require 'bee.filesystem' local function expanduser(path)