2014-06-01 15:53:09 +00:00
|
|
|
local A = require("android")
|
2014-06-03 14:35:29 +00:00
|
|
|
A.dl.library_path = A.dl.library_path .. ":" .. A.dir .. "/libs"
|
2014-06-01 15:53:09 +00:00
|
|
|
|
2014-10-28 18:27:29 +00:00
|
|
|
-- check uri of the intent that starts this application
|
|
|
|
local file = A.jni:context(A.app.activity.vm, function(JNI)
|
|
|
|
local uri = JNI:callObjectMethod(
|
|
|
|
JNI:callObjectMethod(
|
|
|
|
A.app.activity.clazz,
|
|
|
|
"getIntent",
|
|
|
|
"()Landroid/content/Intent;"
|
|
|
|
),
|
|
|
|
"getData",
|
|
|
|
"()Landroid/net/Uri;"
|
|
|
|
)
|
|
|
|
if uri ~= nil then
|
|
|
|
local path = JNI:callObjectMethod(
|
|
|
|
uri,
|
|
|
|
"getPath",
|
|
|
|
"()Ljava/lang/String;"
|
|
|
|
)
|
|
|
|
return JNI:to_string(path)
|
|
|
|
end
|
|
|
|
end)
|
|
|
|
A.LOGI("intent file path " .. (file or ""))
|
|
|
|
|
2014-10-16 01:24:59 +00:00
|
|
|
-- create fake command-line arguments
|
2014-10-28 18:27:29 +00:00
|
|
|
arg = {"-d", file or "/sdcard"}
|
2014-06-01 15:53:09 +00:00
|
|
|
dofile(A.dir.."/reader.lua")
|