summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2018-01-30 22:36:44 +0800
committerruki <[email protected]>2018-01-30 09:40:28 +0800
commitcebb3b1d1e5c07e0a2c5a9b8f61468e71c6d2f71 (patch)
tree2e5e3da8bd6f045f1aa2c96af1e8453e96d2f017
parent4507b7dcaace4d9aa57136118b7eca77570770ea (diff)
save configs to options in menuconf
-rw-r--r--xmake/actions/config/menuconf.lua19
1 files changed, 18 insertions, 1 deletions
diff --git a/xmake/actions/config/menuconf.lua b/xmake/actions/config/menuconf.lua
index 2ef6a1cc0..659c47445 100644
--- a/xmake/actions/config/menuconf.lua
+++ b/xmake/actions/config/menuconf.lua
@@ -145,8 +145,9 @@ function app:project_configs()
for name, opt in pairs(opts) do
if opt:get("showmenu") then
+ -- TODO
-- the default value
- local default = nil
+ local default = "auto"
if opt:get("default") ~= nil then
default = opt:get("default")
end
@@ -185,8 +186,24 @@ function app:load()
self:mconfdialog():load(configs)
end
+-- save the given configs
+function app:save_configs(configs)
+ local options = option.options()
+ for _, conf in pairs(configs) do
+ if conf.kind == "menu" then
+ self:save_configs(conf.configs)
+ elseif not conf.new and (conf.kind == "boolean" or conf.kind == "string") then
+ options[conf.name] = conf.value
+ elseif not conf.new and (conf.kind == "choice") then
+ options[conf.name] = conf.values[conf.value]
+ end
+ end
+end
+
-- save configs to options
function app:save()
+ self:save_configs(self:basic_configs())
+ self:save_configs(self:project_configs())
end
-- main entry