mirror of
https://github.com/koreader/koreader.git
synced 2025-08-10 00:52:38 +00:00
refactor: move bootstrap code into setupkoenv.lua
add ffi.load patch add kodev prompt command
This commit is contained in:
24
reader.lua
24
reader.lua
@@ -14,37 +14,19 @@ io.stdout:flush()
|
||||
|
||||
|
||||
-- load default settings
|
||||
require "defaults"
|
||||
require("defaults")
|
||||
local DataStorage = require("datastorage")
|
||||
pcall(dofile, DataStorage:getDataDir() .. "/defaults.persistent.lua")
|
||||
|
||||
-- set search path for 'require()'
|
||||
package.path =
|
||||
"common/?.lua;rocks/share/lua/5.1/?.lua;frontend/?.lua;" ..
|
||||
package.path
|
||||
package.cpath =
|
||||
"common/?.so;common/?.dll;/usr/lib/lua/?.so;rocks/lib/lua/5.1/?.so;" ..
|
||||
package.cpath
|
||||
require("setupkoenv")
|
||||
|
||||
-- set search path for 'ffi.load()'
|
||||
local ffi = require("ffi")
|
||||
local util = require("ffi/util")
|
||||
ffi.cdef[[
|
||||
char *getenv(const char *name);
|
||||
int putenv(const char *envvar);
|
||||
int _putenv(const char *envvar);
|
||||
]]
|
||||
if ffi.os == "Windows" then
|
||||
ffi.C._putenv("PATH=libs;common;")
|
||||
end
|
||||
|
||||
local _ = require("gettext")
|
||||
-- read settings and check for language override
|
||||
-- has to be done before requiring other files because
|
||||
-- they might call gettext on load
|
||||
G_reader_settings = require("luasettings"):open(
|
||||
DataStorage:getDataDir().."/settings.reader.lua")
|
||||
local lang_locale = G_reader_settings:readSetting("language")
|
||||
local _ = require("gettext")
|
||||
if lang_locale then
|
||||
_.changeLang(lang_locale)
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user