summaryrefslogtreecommitdiff
path: root/xmake/core/sandbox/modules/string.lua
diff options
context:
space:
mode:
authorruki <[email protected]>2017-06-13 20:51:15 +0800
committerruki <[email protected]>2017-06-13 20:51:15 +0800
commit0ee5a8ae20143a27ca051e56712beeddb02e7b4a (patch)
tree7b56ea1b629a0d37b7124fb7abaafdeb273ffd8a /xmake/core/sandbox/modules/string.lua
parent48529599248c9bdd43b53def4be7113d226060ef (diff)
fix filter escape and find_path bug
Diffstat (limited to 'xmake/core/sandbox/modules/string.lua')
-rw-r--r--xmake/core/sandbox/modules/string.lua11
1 files changed, 5 insertions, 6 deletions
diff --git a/xmake/core/sandbox/modules/string.lua b/xmake/core/sandbox/modules/string.lua
index 3079c6e23..d698c9e71 100644
--- a/xmake/core/sandbox/modules/string.lua
+++ b/xmake/core/sandbox/modules/string.lua
@@ -46,12 +46,14 @@ function sandbox_string.vformat(format, ...)
local instance = sandbox.instance()
assert(instance)
- -- ignore %$(...)
- format = format:gsub("%%%$", "__$__")
-
-- format string if exists arguments
local result = format
if #{...} > 0 then
+
+ -- escape "%$", "%(", "%)" to '$', '(', ')'
+ format = format:gsub("%%([%$%(%)])", "%%%%%1")
+
+ -- try to format it
result = string.format(format, ...)
end
assert(result)
@@ -62,9 +64,6 @@ function sandbox_string.vformat(format, ...)
result = filter:handle(result)
end
- -- escape to $(...)
- result = result:gsub("__%$__", "$")
-
-- ok?
return result
end