1***@163.com
1***@163.com
  • 发布:2025-04-27 10:38
  • 更新:2025-04-27 10:38
  • 阅读:722

uni.chooseVideo 返回路径 这段代码ios是没有问题的,android 10 有了分片存储后file文件找不到

分类:uni-app

static async copyFileToPrivate(srcPath, destPath) {
console.log('原始路径:', srcPath)
return new Promise((resolve, reject) => {
console.log('1. 开始解析源路径');

    plus.io.resolveLocalFileSystemURL(  
        srcPath,  
        (entry) => {  
            console.log('2. 成功解析源文件',  entry.);  

            const fileName = destPath.split('/').pop();  
            console.log('3. 准备复制到', fileName);  

            entry.copyTo(  
                null, // 父目录(null表示相同目录)  
                fileName,  
                (copiedEntry) => {  
                    console.log('4. 复制成功', copiedEntry);  
                    const finalPath = copiedEntry.toLocalURL();  
                    console.log('最终路径:', finalPath);  
                    resolve(finalPath);  
                },  
                (err) => {  
                    console.error('5. 复制失败', err);  
                    reject(new Error(`复制失败: ${JSON.stringify(err)}`));  
                }  
            );  
        },  
        (err) => {  
            console.error('6. 解析源路径失败', err);  
            reject(new Error(`路径解析失败: ${JSON.stringify(err)}`));  
        }  
    );  
});  

}

2025-04-27 10:38 负责人:无 分享
已邀请:

要回复问题请先登录注册