add datastorage module to handle data directory on various platform

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.
This commit is contained in:
chrox
2015-06-15 16:46:43 +08:00
parent b1c0bc603a
commit 34ea9ac574
7 changed files with 45 additions and 14 deletions

View File

@@ -1,6 +1,7 @@
local TileCacheItem = require("document/tilecacheitem")
local KOPTContext = require("ffi/koptcontext")
local Document = require("document/document")
local DataStorage = require("datastorage")
local CacheItem = require("cacheitem")
local Screen = require("device").screen
local Geom = require("ui/geometry")
@@ -11,7 +12,7 @@ local util = require("ffi/util")
local KoptInterface = {
ocrengine = "ocrengine",
tessocr_data = "data",
tessocr_data = DataStorage:getDataDir() .. "/data",
ocr_lang = "eng",
ocr_type = 3, -- default 0, for more accuracy use 3
last_context_size = nil,