feat: add network management UI for kobo

This commit is contained in:
Qingping Hou
2016-06-25 17:53:08 -07:00
parent ab9a86788f
commit 20eb36a03d
32 changed files with 970 additions and 107 deletions

View File

@@ -4,8 +4,10 @@ local lfs = require("libs/libkoreader-lfs")
local DataStorage = {}
local data_dir
function DataStorage:getDataDir()
local data_dir
if data_dir then return data_dir end
if isAndroid then
data_dir = "/sdcard/koreader"
elseif os.getenv("UBUNTU_APPLICATION_ISOLATION") then
@@ -19,6 +21,7 @@ function DataStorage:getDataDir()
if lfs.attributes(data_dir, "mode") ~= "directory" then
lfs.mkdir(data_dir)
end
return data_dir
end
@@ -26,9 +29,16 @@ function DataStorage:getHistoryDir()
return self:getDataDir() .. "/history"
end
function DataStorage:getSettingsDir()
return self:getDataDir() .. "/settings"
end
local function initDataDir()
local data_dir = DataStorage:getDataDir()
local sub_data_dirs = {"cache", "clipboard", "data", "history", "ota", "screenshots"}
local sub_data_dirs = {
"cache", "clipboard", "data", "history",
"ota", "screenshots", "settings",
}
for _, dir in ipairs(sub_data_dirs) do
local sub_data_dir = data_dir .. "/" .. dir
if lfs.attributes(sub_data_dir, "mode") ~= "directory" then