From cebb3b1d1e5c07e0a2c5a9b8f61468e71c6d2f71 Mon Sep 17 00:00:00 2001 From: ruki Date: Tue, 30 Jan 2018 22:36:44 +0800 Subject: save configs to options in menuconf --- xmake/actions/config/menuconf.lua | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) 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 -- cgit v1.3.1