2019-08-29 21:59:39 +02:00
|
|
|
local android = require("android")
|
|
|
|
|
android.dl.library_path = android.dl.library_path .. ":" .. android.dir .. "/libs"
|
2014-06-01 11:53:09 -04:00
|
|
|
|
2020-06-19 21:23:47 +02:00
|
|
|
local lfs = require("libs/libkoreader-lfs")
|
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-08-29 21:59:39 +02:00
|
|
|
local file = android.getIntent()
|
2018-12-29 20:48:19 +01:00
|
|
|
|
|
|
|
|
if file ~= nil then
|
2019-08-29 21:59:39 +02:00
|
|
|
android.LOGI("intent file path " .. file)
|
2018-12-29 20:48:19 +01:00
|
|
|
end
|
2014-10-29 02:27:29 +08:00
|
|
|
|
2019-10-14 01:24:46 +02:00
|
|
|
-- path to primary external storage partition
|
|
|
|
|
local path = android.getExternalStoragePath()
|
|
|
|
|
|
2015-06-15 16:46:43 +08:00
|
|
|
-- set TESSDATA_PREFIX env var
|
2019-10-14 01:24:46 +02:00
|
|
|
C.setenv("TESSDATA_PREFIX", path.."/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-08-29 21:59:39 +02:00
|
|
|
-- luacheck: ignore 121
|
|
|
|
|
if android.isDebuggable() then
|
2021-01-07 14:38:10 -05:00
|
|
|
arg = {"-d", file}
|
2019-04-17 20:04:07 +02:00
|
|
|
else
|
2021-01-07 14:38:10 -05:00
|
|
|
arg = {file}
|
2019-04-17 20:04:07 +02:00
|
|
|
end
|
|
|
|
|
|
2019-08-29 21:59:39 +02:00
|
|
|
dofile(android.dir.."/reader.lua")
|