diff --git a/frontend/apps/reader/modules/readerdictionary.lua b/frontend/apps/reader/modules/readerdictionary.lua index a7ab37826..823cd6789 100644 --- a/frontend/apps/reader/modules/readerdictionary.lua +++ b/frontend/apps/reader/modules/readerdictionary.lua @@ -70,12 +70,18 @@ function ReaderDictionary:stardictLookup(word, box) word = require("util").stripePunctuations(word) DEBUG("stripped word:", word) -- escape quotes and other funny characters in word - local std_out = io.popen("./sdcv --utf8-input --utf8-output -nj " - .. ("%q"):format(word) .. " --data-dir " .. self.data_dir, "r") local results_str = nil - if std_out then - results_str = std_out:read("*all") - std_out:close() + if Device:isAndroid() then + local A = require("android") + results_str = A.stdout("./sdcv", "--utf8-input", "--utf8-output", + "-nj", word, "--data-dir", self.data_dir) + else + local std_out = io.popen("./sdcv --utf8-input --utf8-output -nj " + .. ("%q"):format(word) .. " --data-dir " .. self.data_dir, "r") + if std_out then + results_str = std_out:read("*all") + std_out:close() + end end --DEBUG("result str:", word, results_str) local ok, results = pcall(JSON.decode, results_str) diff --git a/platform/android/llapp_main.lua b/platform/android/llapp_main.lua index 94f2d12c9..03297cf8a 100644 --- a/platform/android/llapp_main.lua +++ b/platform/android/llapp_main.lua @@ -27,7 +27,7 @@ A.LOGI("intent file path " .. (file or "")) pcall(function() dofile("/sdcard/koreader/patch.lua") end) -- set proper permission for sdcv -io.popen("chmod 755 ./sdcv") +A.execute("chmod", "755", "./sdcv") -- create fake command-line arguments arg = {"-d", file or "/sdcard"} diff --git a/platform/android/luajit-launcher b/platform/android/luajit-launcher index a00e3d1c7..ddcf09b0f 160000 --- a/platform/android/luajit-launcher +++ b/platform/android/luajit-launcher @@ -1 +1 @@ -Subproject commit a00e3d1c7f73756a3c3cf45b1828c2b55a903503 +Subproject commit ddcf09b0f8b60e8e3137b818c973aee3ff76d3f4