跳至主要內容

取得 App 的應用分組資訊 (app.group_info)

聲明

應用分組資訊 = app.group_info(應用包標識符)

參數

  • 應用包標識符
    文字型,如需要定位應用的應用包標識符,可於 XXT 應用程式--更多--應用清單 中查看

回傳值

  • 應用分組資訊
    表型,返回應用程式的分組資訊,格式為 {group_id = data_path, ...}。若不存在則返回空表

範例

local function clear_dir(path)
for _, fn in ipairs(file.list(path) or {}) do
local full_path = path .. '/' .. fn
file.remove(full_path)
end
end
--
local info = app.group_info("com.tencent.mqq") -- 獲得 QQ 的分組信息
--
-- 循環刪除所有分組目錄中的內容
for _,p in pairs(info) do
for _,v in ipairs(file.list(p) or {}) do
local path = p .. '/' .. v
if file.exists(path) == 'directory' then
clear_dir(path)
elseif v ~= '.com.apple.mobile_container_manager.metadata.plist' then
file.remove(path)
end
end
end