diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2021-08-11 10:12:43 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2021-08-11 10:12:43 +0800 |
commit | ad58184e9e1a4d8e24e657a855bdc73d3ffb2f74 (patch) | |
tree | b483e42b506d11de83fbe096accc17b64f4f5900 | |
parent | da9996242802235c4d3dbc8de1e5858979f2fc16 (diff) | |
download | lua-language-server-ad58184e9e1a4d8e24e657a855bdc73d3ffb2f74.zip |
expand path `$HOME`
-rw-r--r-- | script/utility.lua | 4 |
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) |