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

@@ -2,7 +2,8 @@
-- load default settings
require "defaults"
pcall(dofile, "defaults.persistent.lua")
local DataStorage = require("datastorage")
pcall(dofile, DataStorage:getDataDir() .. "/defaults.persistent.lua")
-- set search path for 'require()'
package.path = "common/?.lua;rocks/share/lua/5.1/?.lua;frontend/?.lua;" .. package.path