summaryrefslogtreecommitdiff
path: root/xmake/scripts/base
diff options
context:
space:
mode:
Diffstat (limited to 'xmake/scripts/base')
-rw-r--r--xmake/scripts/base/config.lua7
-rw-r--r--xmake/scripts/base/global.lua6
-rw-r--r--xmake/scripts/base/preprocessor.lua4
3 files changed, 9 insertions, 8 deletions
diff --git a/xmake/scripts/base/config.lua b/xmake/scripts/base/config.lua
index f53338a05..92721fa70 100644
--- a/xmake/scripts/base/config.lua
+++ b/xmake/scripts/base/config.lua
@@ -38,7 +38,7 @@ function config._save_with_level(file, object, level)
-- save string
if type(object) == "string" then
- file:write(object)
+ file:write(string.format("%q", object))
-- save boolean
elseif type(object) == "boolean" then
file:write(tostring(object))
@@ -153,7 +153,7 @@ function config._make()
-- get configs from all targets
for k, v in pairs(configs) do
- if type(k) == "string" and not k:find("_%u+") then
+ if type(k) == "string" and not k:find("^_%u+") then
current[k] = v
end
end
@@ -217,7 +217,8 @@ end
function config.set(name, value)
-- check
- assert(config._CURRENT and name and value)
+ assert(config._CURRENT)
+ assert(name and value and type(value) ~= "table")
-- get the current target
local target = config._target()
diff --git a/xmake/scripts/base/global.lua b/xmake/scripts/base/global.lua
index 64836bd2c..2371445ee 100644
--- a/xmake/scripts/base/global.lua
+++ b/xmake/scripts/base/global.lua
@@ -38,7 +38,7 @@ function global._save_with_level(file, object, level)
-- save string
if type(object) == "string" then
- file:write(object)
+ file:write(string.format("%q", object))
-- save boolean
elseif type(object) == "boolean" then
file:write(tostring(object))
@@ -120,7 +120,7 @@ function global._make()
-- make current global configure
for k, v in pairs(configs) do
- if type(k) == "string" and not k:find("_%u+") then
+ if type(k) == "string" and not k:find("^_%u+") then
current[k] = v
end
end
@@ -147,7 +147,7 @@ function global.set(name, value)
-- check
assert(global._CURRENT and global._CONFIGS)
- assert(name and value)
+ assert(name and value and type(value) ~= "table")
-- set it to the current configure
global._CURRENT[name] = value
diff --git a/xmake/scripts/base/preprocessor.lua b/xmake/scripts/base/preprocessor.lua
index 10a64593b..0ea137307 100644
--- a/xmake/scripts/base/preprocessor.lua
+++ b/xmake/scripts/base/preprocessor.lua
@@ -129,11 +129,11 @@ function preprocessor._init(root, configures, scopes, filter, import)
_current[key] = nil
elseif table.getn(arg) == 1 then
-- save only one argument
- _current[key] = preprocessor._filter(newenv, arg[1], filter)
+ _current[key] = arg[1]
else
-- save all arguments
for i, v in ipairs(arg) do
- _current[key][i] = preprocessor._filter(newenv, v, filter)
+ _current[key][i] = v
end
end
end