2014-06-01 11:53:09 -04:00
|
|
|
local A = require("android")
|
2014-06-03 16:35:29 +02:00
|
|
|
A.dl.library_path = A.dl.library_path .. ":" .. A.dir .. "/libs"
|
2014-06-01 11:53:09 -04:00
|
|
|
|
2015-06-15 16:46:43 +08:00
|
|
|
local ffi = require("ffi")
|
2019-03-29 20:12:09 +01:00
|
|
|
local dummy = require("ffi/posix_h")
|
2018-06-02 12:10:55 -04:00
|
|
|
local C = ffi.C
|
2015-06-15 16:46:43 +08:00
|
|
|
|
2014-10-29 02:27:29 +08:00
|
|
|
-- check uri of the intent that starts this application
|
2019-01-06 18:13:33 +01:00
|
|
|
local file = A.getIntent()
|
2018-12-29 20:48:19 +01:00
|
|
|
|
|
|
|
|
if file ~= nil then
|
|
|
|
|
A.LOGI("intent file path " .. file)
|
|
|
|
|
end
|
2014-10-29 02:27:29 +08:00
|
|
|
|
2015-03-20 10:03:17 +08:00
|
|
|
-- run koreader patch before koreader startup
|
2017-09-27 21:45:07 +02:00
|
|
|
pcall(dofile, "/sdcard/koreader/patch.lua")
|
2015-03-20 10:03:17 +08:00
|
|
|
|
2019-04-01 15:48:10 +02:00
|
|
|
-- set proper permission for binaries
|
2015-04-22 14:27:05 +08:00
|
|
|
A.execute("chmod", "755", "./sdcv")
|
2016-03-13 23:42:58 +08:00
|
|
|
A.execute("chmod", "755", "./tar")
|
|
|
|
|
A.execute("chmod", "755", "./zsync")
|
2015-04-15 20:28:32 +08:00
|
|
|
|
2015-06-15 16:46:43 +08:00
|
|
|
-- set TESSDATA_PREFIX env var
|
2019-03-29 20:12:09 +01:00
|
|
|
C.setenv("TESSDATA_PREFIX", "/sdcard/koreader/data", 1)
|
2015-06-15 16:46:43 +08:00
|
|
|
|
2014-10-16 09:24:59 +08:00
|
|
|
-- create fake command-line arguments
|
2019-04-17 20:04:07 +02:00
|
|
|
if A.isDebuggable() then
|
|
|
|
|
arg = {"-d", file or "/sdcard"}
|
|
|
|
|
else
|
|
|
|
|
arg = {file or "/sdcard"}
|
|
|
|
|
end
|
|
|
|
|
|
2014-06-01 11:53:09 -04:00
|
|
|
dofile(A.dir.."/reader.lua")
|