From bee6cc1eb08ce7f48b4f58b04effbdd707fc44b3 Mon Sep 17 00:00:00 2001 From: ruki Date: Sat, 13 Feb 2016 19:55:41 +0800 Subject: get sandbox instance from modules and impl vformat --- xmake/core/base/interpreter.lua | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) (limited to 'xmake/core/base/interpreter.lua') 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 -- cgit v1.3.1