2
0
mirror of https://github.com/koreader/koreader synced 2024-11-10 01:10:34 +00:00

load Device module after DEBUG is turned on

otherwise some DEBUGs are not printed.
This commit is contained in:
chrox 2014-11-06 15:07:50 +08:00
parent a5cff2c42b
commit dec9a99fba

View File

@ -17,8 +17,6 @@ end
local DocSettings = require("docsettings")
local _ = require("gettext")
local util = require("ffi/util")
-- read settings and check for language override
-- has to be done before requiring other files because
-- they might call gettext on load
@ -28,31 +26,6 @@ if lang_locale then
_.changeLang(lang_locale)
end
local lfs = require("libs/libkoreader-lfs")
local UIManager = require("ui/uimanager")
local Device = require("device")
local Screen = require("device").screen
local input = require("ffi/input")
local DEBUG = require("dbg")
local Profiler = nil
local function exitReader()
local ReaderActivityIndicator = require("apps/reader/modules/readeractivityindicator")
G_reader_settings:close()
-- Close lipc handles
ReaderActivityIndicator:coda()
-- shutdown hardware abstraction
Device:exit()
if Profiler then Profiler.stop() end
os.exit(0)
end
-- option parsing:
local longopts = {
debug = "d",
@ -78,6 +51,11 @@ local function showusage()
return
end
-- should check DEBUG option in arg and turn on DEBUG before loading other
-- modules, otherwise DEBUG in some modules may not be printed.
local DEBUG = require("dbg")
local Profiler = nil
local ARGV = arg
local argidx = 1
while argidx <= #ARGV do
@ -104,6 +82,12 @@ while argidx <= #ARGV do
end
end
local lfs = require("libs/libkoreader-lfs")
local UIManager = require("ui/uimanager")
local Device = require("device")
local Screen = require("device").screen
local Font = require("ui/font")
-- read some global reader setting here:
-- font
local fontmap = G_reader_settings:readSetting("fontmap")
@ -160,4 +144,19 @@ else
return showusage()
end
local function exitReader()
local ReaderActivityIndicator = require("apps/reader/modules/readeractivityindicator")
G_reader_settings:close()
-- Close lipc handles
ReaderActivityIndicator:coda()
-- shutdown hardware abstraction
Device:exit()
if Profiler then Profiler.stop() end
os.exit(0)
end
exitReader()