1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2025-12-23 15:52:29 +01:00

add %VAR% environment variable expansion for Windows

This commit is contained in:
Doug Kearns
2008-10-19 07:44:49 +00:00
parent d14a32afa3
commit 19e4bcac3a

View File

@@ -427,10 +427,11 @@ function IO() //{{{
}
// expand any $ENV vars - this is naive but so is Vim and we like to be compatible
// TODO: Vim does not expand variables set to an empty string - are we just matching a bug?
// TODO: Vim does not expand variables set to an empty string, nor does it recognise
// ${VAR} on WINDOWS - are we just matching bugs?
path = path.replace(
/\$(?:{\w+}|\w+\b)/g,
function (v) environmentService.get(v.replace(/\${?(\w+)}?/, "$1")) || v
RegExp("(?:\\$(\\w+)\\b|" + (WINDOWS ? "%(\\w+)%" : "\\${(\\w+)}") + ")", "g"),
function (m, n1, n2, i, s) environmentService.get((n1 || n2), "$1")
);
return path;