mirror of
https://github.com/lxsang/antd-web-apps
synced 2024-11-19 18:08:21 +01:00
Move system package caches to tmp dir
All checks were successful
gitea-sync/antd-web-apps/pipeline/head This commit looks good
All checks were successful
gitea-sync/antd-web-apps/pipeline/head This commit looks good
See issue #40
This commit is contained in:
parent
f737109330
commit
1d9107cc04
@ -3,8 +3,11 @@ local vfs = require("vfs")
|
||||
local uid = ulib.uid(SESSION.user)
|
||||
|
||||
packages._cache = function(y)
|
||||
local p = vfs.ospath(y)
|
||||
local f = io.open(p.."/packages.json", "w")
|
||||
local p = vfs.ospath(y).."/packages.cache"
|
||||
if y:find("^os://") then
|
||||
p = __api__.tmpdir.."/packages.cache"
|
||||
end
|
||||
local f = io.open(p, "w")
|
||||
local has_cache = false
|
||||
local i = 1
|
||||
local meta = {}
|
||||
@ -28,7 +31,7 @@ packages._cache = function(y)
|
||||
f:write(table.concat(meta, ","))
|
||||
f:close()
|
||||
if has_cache == false then
|
||||
ulib.delete(p.."/packages.json");
|
||||
ulib.delete(p);
|
||||
end
|
||||
end
|
||||
end
|
||||
@ -40,7 +43,10 @@ packages.list = function(paths)
|
||||
local first = true
|
||||
--std.f(__ROOT__.."/system/packages.json")
|
||||
for k,v in pairs(paths) do
|
||||
local osp = vfs.ospath(v.."/packages.json")
|
||||
local osp = vfs.ospath(v.."/packages.cache")
|
||||
if v:find("^os://") then
|
||||
osp = __api__.tmpdir.."/packages.cache"
|
||||
end
|
||||
if ulib.exists(osp) == false then
|
||||
packages._cache(v)
|
||||
end
|
||||
@ -116,4 +122,4 @@ packages.init = function(paths)
|
||||
end
|
||||
end
|
||||
|
||||
return packages
|
||||
return packages
|
||||
|
Loading…
Reference in New Issue
Block a user