mirror of
https://github.com/koreader/koreader.git
synced 2025-12-24 12:14:05 +01:00
load Device module after DEBUG is turned on
otherwise some DEBUGs are not printed.
This commit is contained in:
53
reader.lua
53
reader.lua
@@ -17,8 +17,6 @@ end
|
|||||||
|
|
||||||
local DocSettings = require("docsettings")
|
local DocSettings = require("docsettings")
|
||||||
local _ = require("gettext")
|
local _ = require("gettext")
|
||||||
local util = require("ffi/util")
|
|
||||||
|
|
||||||
-- read settings and check for language override
|
-- read settings and check for language override
|
||||||
-- has to be done before requiring other files because
|
-- has to be done before requiring other files because
|
||||||
-- they might call gettext on load
|
-- they might call gettext on load
|
||||||
@@ -28,31 +26,6 @@ if lang_locale then
|
|||||||
_.changeLang(lang_locale)
|
_.changeLang(lang_locale)
|
||||||
end
|
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:
|
-- option parsing:
|
||||||
local longopts = {
|
local longopts = {
|
||||||
debug = "d",
|
debug = "d",
|
||||||
@@ -78,6 +51,11 @@ local function showusage()
|
|||||||
return
|
return
|
||||||
end
|
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 ARGV = arg
|
||||||
local argidx = 1
|
local argidx = 1
|
||||||
while argidx <= #ARGV do
|
while argidx <= #ARGV do
|
||||||
@@ -104,6 +82,12 @@ while argidx <= #ARGV do
|
|||||||
end
|
end
|
||||||
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:
|
-- read some global reader setting here:
|
||||||
-- font
|
-- font
|
||||||
local fontmap = G_reader_settings:readSetting("fontmap")
|
local fontmap = G_reader_settings:readSetting("fontmap")
|
||||||
@@ -160,4 +144,19 @@ else
|
|||||||
return showusage()
|
return showusage()
|
||||||
end
|
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()
|
exitReader()
|
||||||
|
|||||||
Reference in New Issue
Block a user