datastorage: add support for isolating data

Use the `KO_HOME` environment variable if set to determine the data directory location.
This commit is contained in:
Benoit Pierre
2024-11-24 23:05:33 +01:00
committed by Frans de Jonge
parent f5c6b56899
commit 76837c66a7

View File

@@ -10,7 +10,9 @@ local full_data_dir
function DataStorage:getDataDir() function DataStorage:getDataDir()
if data_dir then return data_dir end if data_dir then return data_dir end
if isAndroid then if os.getenv("KO_HOME") then
data_dir = os.getenv("KO_HOME")
elseif isAndroid then
data_dir = android.getExternalStoragePath() .. "/koreader" data_dir = android.getExternalStoragePath() .. "/koreader"
elseif os.getenv("UBUNTU_APPLICATION_ISOLATION") then elseif os.getenv("UBUNTU_APPLICATION_ISOLATION") then
local app_id = os.getenv("APP_ID") local app_id = os.getenv("APP_ID")