From c1460e5be7f4b4e3356a8bda99703828c356cbfb Mon Sep 17 00:00:00 2001 From: ruki Date: Tue, 22 Mar 2016 11:10:25 +0800 Subject: escape $ for vformat --- xmake/core/sandbox/modules/string.lua | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'xmake/core/sandbox/modules/string.lua') diff --git a/xmake/core/sandbox/modules/string.lua b/xmake/core/sandbox/modules/string.lua index 69ddbb723..6a7a455d7 100644 --- a/xmake/core/sandbox/modules/string.lua +++ b/xmake/core/sandbox/modules/string.lua @@ -44,6 +44,9 @@ function sandbox_string.vformat(format, ...) local instance = sandbox.instance() assert(instance) + -- ignore %$(...) + format = format:gsub("%%%$", "__$__") + -- format string local result = string.format(format, ...) assert(result) @@ -54,6 +57,9 @@ function sandbox_string.vformat(format, ...) result = filter:handle(result) end + -- escape to $(...) + result = result:gsub("__%$__", "$") + -- ok? return result end -- cgit v1.3.1