mirror of
https://github.com/koreader/koreader
synced 2024-11-11 19:11:14 +00:00
34ea9ac574
On kindle, kobo and pocketbook the data directory is the current running directory but on Android the app is installed in system defined location and users may have no access to that location. The same circumstances should be true for the upcoming Koreader for Ubuntu touch, so the data directory (in which tessdata, dictionaries, global settings, persistant defaults and probably history data are stored) could be stored in another place.
15 lines
296 B
Lua
15 lines
296 B
Lua
-- need low-level mechnism to detect android to avoid recursive dependency
|
|
local isAndroid = pcall(require, "android")
|
|
|
|
local DataStorage = {}
|
|
|
|
function DataStorage:getDataDir()
|
|
if isAndroid then
|
|
return "/sdcard/koreader/"
|
|
else
|
|
return "./"
|
|
end
|
|
end
|
|
|
|
return DataStorage
|