implement settings version #120 and migration #134

Latest changes for history support move configuration files into
history directory to keep them as timestamp for last read. This code
also adds reading of old configuration files (but does not remove them)
Dobrica Pavlinusic 12 years ago
parent 9de055eb5d
commit f55654f03e

@ -29,10 +29,35 @@ function HistoryToPath(history)
end
function DocSettings:open(docfile)
-- history feature moves configuration files into history directory
lfs.mkdir("./history")
local new = { file = DocToHistory(docfile), data = {} }
local ok, stored = pcall(dofile,new.file)
if not ok then
ok, stored = pcall(dofile,docfile..".kpdfview.lua")
end
if ok then
if stored.version == nil then
stored.version = 0
end
if stored.version < 2012.05 then
debug("settings", docfile, stored)
if stored.jumpstack ~= nil then
stored.jump_history = stored.jumpstack
stored.jumpstack = nil
if not stored.jump_history.cur then
stored.jump_history.cur = 1
end
end
if stored.globalzoommode ~= nil then
stored.globalzoom_mode = stored.globalzoommode
stored.globalzoommode = nil
end
stored.version = 2012.05
debug("upgraded", stored)
end
new.data = stored
end
return setmetatable(new, { __index = DocSettings})

Loading…
Cancel
Save