summaryrefslogtreecommitdiff
path: root/xmake/core/base/interpreter.lua
diff options
context:
space:
mode:
authorruki <[email protected]>2016-02-13 19:55:41 +0800
committerruki <[email protected]>2016-02-15 19:10:27 +0800
commitbee6cc1eb08ce7f48b4f58b04effbdd707fc44b3 (patch)
tree9cd5668f4eb70f0e10a8131129032234b6d32b7d /xmake/core/base/interpreter.lua
parent46ddc77c6cc909a994d8ccc73bdafaf9094585a5 (diff)
get sandbox instance from modules and impl vformat
Diffstat (limited to 'xmake/core/base/interpreter.lua')
-rw-r--r--xmake/core/base/interpreter.lua13
1 files changed, 5 insertions, 8 deletions
diff --git a/xmake/core/base/interpreter.lua b/xmake/core/base/interpreter.lua
index c2d94a2f8..30e79e907 100644
--- a/xmake/core/base/interpreter.lua
+++ b/xmake/core/base/interpreter.lua
@@ -752,19 +752,16 @@ function interpreter.api_register_set_script(self, scope_kind, prefix, ...)
-- define implementation
local implementation = function (self, scope, name, script)
- -- check
- if script == nil then
- utils.error("set_%s(\"%s\"): no script", scope, name)
- utils.abort()
- end
- if type(script) == "string" and not os.isfile(script) then
- utils.error("set_%s(\"%s\"): scriptfile(%s) not found!", scope, name, script)
+ -- bind script and get new script with sandbox
+ local newscript, errors = sandbox.bind(script, self._PRIVATE._FILTER)
+ if not newscript then
+ utils.error("set_%s(\"%s\"): %s", scope, name, errors)
utils.abort()
end
-- update script?
scope[name] = {}
- table.insert(scope[name], script)
+ table.insert(scope[name], newscript)
end