From ad58184e9e1a4d8e24e657a855bdc73d3ffb2f74 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=80=E8=90=8C=E5=B0=8F=E6=B1=90?= Date: Wed, 11 Aug 2021 10:12:43 +0800 Subject: expand path `$HOME` --- script/utility.lua | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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) -- cgit v1.2.3