summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2021-08-11 10:12:43 +0800
committer最萌小汐 <sumneko@hotmail.com>2021-08-11 10:12:43 +0800
commitad58184e9e1a4d8e24e657a855bdc73d3ffb2f74 (patch)
treeb483e42b506d11de83fbe096accc17b64f4f5900
parentda9996242802235c4d3dbc8de1e5858979f2fc16 (diff)
downloadlua-language-server-ad58184e9e1a4d8e24e657a855bdc73d3ffb2f74.zip
expand path `$HOME`
-rw-r--r--script/utility.lua4
1 files changed, 3 insertions, 1 deletions
diff --git a/script/utility.lua b/script/utility.lua
index d1a539a5..f62c7af3 100644
--- a/script/utility.lua
+++ b/script/utility.lua
@@ -643,9 +643,11 @@ function m.expandPath(path)
home = getenv 'USERPROFILE' or (getenv 'HOMEDRIVE' .. getenv 'HOMEPATH')
end
return home .. path:sub(2)
- else
+ elseif path:sub(1, 1) == '$' then
+ path = path:gsub('%$([%w_]+)', getenv)
return path
end
+ return path
end
function m.arrayToHash(l)