From 19e4bcac3a6495e36c3697526c52c4cf3adeb5eb Mon Sep 17 00:00:00 2001 From: Doug Kearns Date: Sun, 19 Oct 2008 07:44:49 +0000 Subject: [PATCH] add %VAR% environment variable expansion for Windows --- content/io.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/content/io.js b/content/io.js index 2c8001ff..d7229cfa 100644 --- a/content/io.js +++ b/content/io.js @@ -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;