diff options
| author | ruki <[email protected]> | 2016-03-22 11:10:25 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2016-03-22 11:10:25 +0800 |
| commit | c1460e5be7f4b4e3356a8bda99703828c356cbfb (patch) | |
| tree | d490ad26a4291c8e38513212ff34380abec60214 /xmake/core/sandbox/modules/string.lua | |
| parent | 399d87fadad1e965c1fbb11db74c0c249abfaf9f (diff) | |
escape $ for vformat
Diffstat (limited to 'xmake/core/sandbox/modules/string.lua')
| -rw-r--r-- | xmake/core/sandbox/modules/string.lua | 6 |
1 files changed, 6 insertions, 0 deletions
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 |
