Make app:fixConfig and app:fixHotkeys use defaults (#2106)

* Make app:fixConfig and app:fixHotkeys use defaults

Currently, the `app:fixConfig` and `app:fixHotkeys` functions were using the config.txt values as default.
This patch now points them to actually use the default values in our lua files.
This commit is contained in:
lewri
2022-03-03 03:32:25 +00:00
committed by GitHub
parent 9a03f3a41f
commit 43295a3494
5 changed files with 6 additions and 6 deletions

View File

@@ -135,7 +135,7 @@ TheApp = App()
TheApp:setCommandLine(
"--bitmap-dir=" ..base_dir.. "Bitmap",
"--config-file=" .. select(1, corsixth.require("config_finder")),
"--hotkeys-file=" .. select(3, corsixth.require("config_finder")),
"--hotkeys-file=" .. select(4, corsixth.require("config_finder")),
-- If a command line option is given twice, the later one is used, hence
-- if the user gave one of the above, that will be used instead.
...

View File

@@ -805,7 +805,7 @@ end
function App:fixConfig()
-- Fill in default values for things which don't exist
local config_defaults = select(2, corsixth.require("config_finder"))
local config_defaults = select(3, corsixth.require("config_finder"))
for k, v in pairs(config_defaults) do
if self.config[k] == nil then
self.config[k] = v
@@ -925,7 +925,7 @@ end
function App:fixHotkeys()
-- Fill in default values for things which don't exist
local hotkeys_defaults = select(4, corsixth.require("config_finder"))
local hotkeys_defaults = select(6, corsixth.require("config_finder"))
for k, v in pairs(hotkeys_defaults) do
if self.hotkeys[k] == nil then

View File

@@ -855,4 +855,4 @@ for k, str_val in pairs(hotkeys_values) do
end
end
return config_filename, config_values, hotkeys_filename, hotkeys_values, hotkeys_defaults, config_data
return config_filename, config_values, config_defaults, hotkeys_filename, hotkeys_values, hotkeys_defaults, config_data

View File

@@ -503,7 +503,7 @@ end
function UIHotkeyAssign:buttonDefaults()
-- Copy the default hotkeys into the app's current hotkey table.
self.app.hotkeys = shallow_clone(select(5, corsixth.require("config_finder")))
self.app.hotkeys = shallow_clone(select(6, corsixth.require("config_finder")))
-- Reload all hotkey boxes' text.
for k, _ in pairs(self.hotkey_buttons) do

View File

@@ -29,7 +29,7 @@ local function path(tbl)
end
local config_path = path({"CorsixTH", "Lua", "config_finder.lua"})
local config_data = select(6, dofile(config_path))
local config_data = select(7, dofile(config_path))
local template_path = path({"WindowsInstaller", "config_template.txt"})
local f, err = io.open(template_path, "w")