mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2025-12-23 16:12:26 +01:00
add %VAR% environment variable expansion for Windows
This commit is contained in:
@@ -427,10 +427,11 @@ function IO() //{{{
|
|||||||
}
|
}
|
||||||
|
|
||||||
// expand any $ENV vars - this is naive but so is Vim and we like to be compatible
|
// 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(
|
path = path.replace(
|
||||||
/\$(?:{\w+}|\w+\b)/g,
|
RegExp("(?:\\$(\\w+)\\b|" + (WINDOWS ? "%(\\w+)%" : "\\${(\\w+)}") + ")", "g"),
|
||||||
function (v) environmentService.get(v.replace(/\${?(\w+)}?/, "$1")) || v
|
function (m, n1, n2, i, s) environmentService.get((n1 || n2), "$1")
|
||||||
);
|
);
|
||||||
|
|
||||||
return path;
|
return path;
|
||||||
|
|||||||
Reference in New Issue
Block a user