Skip to content
This repository has been archived by the owner on May 21, 2024. It is now read-only.

Commit

Permalink
fix: reviewing commit 78bda6, now they're not being overwritten for s…
Browse files Browse the repository at this point in the history
…ure (I hope), can be used to overwrite other values in the tomls, thus only the double quotes are used to let a given field unchanged
  • Loading branch information
jodros committed Dec 26, 2023
1 parent 018f0af commit 089ab51
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions core/gatherer.lua
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ function merge(fallback, localfile, count) -- it runs through both files and com
for key, value in pairs(fallback) do -- overwrites any value declared in the localfile
if type(value) == "table" and localfile[key] then
T[key], count = merge(T[key], localfile[key], count)
elseif localfile[key] and localfile[key] ~= "" then
elseif localfile[key] ~= nil and localfile[key] ~= "" then
T[key] = localfile[key]
elseif localfile[key] == nil then
T[key] = fallback[key]
Expand All @@ -92,13 +92,10 @@ local function geToml()
local locLayout = dotsile .. "layouts/" .. layoutPath
local settings = lfs.currentdir() .. "/settings.toml"

if not fileExist(dotsile) then
lfs.mkdir(dotsile)
os.execute("cp " .. datafile.path("config/default.toml") .. " " .. dotsile)
elseif not fileExist(dotsile .. "layouts/") then
lfs.mkdir(dotsile .. "layouts/")
os.execute("cp " .. datafile.path("config/layouts/" .. layoutPath) .. " " .. dotsile .. "layouts/")
end
if not fileExist(dotsile) then lfs.mkdir(dotsile)
elseif not fileExist(dotsile .. "layouts/") then lfs.mkdir(dotsile .. "layouts/")
elseif not fileExist(dotsile.."default.toml") then os.execute("cp " .. datafile.path("config/default.toml") .. " " .. dotsile)
elseif not fileExist(dotsile.."layouts/generic.toml") then os.execute("cp " .. datafile.path("config/layouts/" .. layoutPath) .. " " .. dotsile .. "layouts/") end

config = merge(super(default), super(locDefault))
layoutConfig = merge(super(layout), super(locLayout))
Expand Down

0 comments on commit 089ab51

Please sign in to comment.