Skip to content

rootList操作无法读取沙盒外的文件夹下有什么文件 #8

@daxia25881

Description

@daxia25881

rootList操作无法读取沙盒外的文件夹下有什么文件
rootread可以读到具体的文件内容

Image

`
async function debugCopyLog() {
console.log("--- 路径深度检测 ---");

// 1. 请在此处粘贴你从 Filza 复制的真实路径
const myPath = "/var/mobile/Containers/Data/Application/{UUID}/Library/CopyLog/Snippets";

if (!file.rootAvailable()) {
    console.error("❌ Root Helper 未生效");
    return;
}

// 2. 使用 rootCheck 检查路径属性
// 这个 API 会返回 { readable, writable, exists, isDirectory }
const check = file.rootCheck(myPath);
console.log("路径检查结果:", JSON.stringify(check));

if (!check.exists) {
    console.error("❌ 路径依然不存在!说明 UUID 肯定还是错的。");
    // 尝试检查上一级目录
    const parent = myPath.split('/').slice(0, -1).join('/');
    console.log("检查父目录是否存在:", file.rootExists(parent));
    return;
}

if (check.isDirectory) {
    console.log("📂 确认这是一个目录,尝试列出内容...");
    const list = file.rootList(myPath);
    if (list) {
        console.log(`✅ 成功!找到 ${list.length} 个文件:`);
        list.forEach(item => console.log(" - " + item));
    } else {
        console.error("❌ 虽然目录存在,但 rootList 返回了 null(可能是权限不足)");
    }
} else {
    console.log("📄 这是一个文件,尝试读取内容...");
    const content = file.rootRead(myPath);
    console.log("文件内容:", content ? content.substring(0, 50) : "无法读取");
}

}

debugCopyLog();

`

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions