我正在尝试重命名已拍摄的图像文件,但我总是使用 error.code = 1 的失败方法
function renameImage(imageURI) {
window.resolveLocalFileSystemURI(imageURI, renameFile, fail);
}
function renameFile(entry){
var parent = entry.fullPath.substr(0, entry.fullPath.lastIndexOf('/'));
deleteFile(entry);
entry.moveTo(parent, newFileName, setImageSrc, fail);
}
deleteFile 工作正常
父级是file:///mnt/sdcard/DCIM/Camera
更新:
var path = obj.src.substr(0, obj.src.lastIndexOf('/'));
window.requestFileSystem(LocalFileSystem.PERSISTENT, 0, function() {}, function() { alert("requestFS");});
window.resolveLocalFileSystemURI(path, function(e) {
path = e
}, function() { alert("resolveFsURI path");});
resolveLocalFileSystemURI 仍然存在错误:1
编辑:它在没有 deleteFile() 的情况下显示相同的反应