我试图重命名已拍摄的图像文件,但我总是使用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()
显示相同的反应答案 0 :(得分:1)
经过一些尝试,我使用它:
navigator.camera.getPicture(function(i) {
window.resolveLocalFileSystemURI(i, function(e) {
var p = e.fullPath.substr(0, e.fullPath.lastIndexOf('/'));
window.resolveLocalFileSystemURI(p, function(dir) {
e.moveTo(dir, newName, function(f) {
changedSomething = true;
var d = new Date();
obj.hide();
//alert(f.fullPath);
obj.attr('src', f.fullPath+'?i='+d.getMilliseconds());
obj.fadeIn(600);
e.remove(onEmptyLoader, onEmptyLoader);}, onErrorLoader);
}, onErrorLoader);
}, onErrorLoader);
}, onErrorLoader, cameraOptions);
抱歉迟到的回复我忘了这个问题:)
答案 1 :(得分:0)
我相信你的问题是你在调用moveTo时父亲是一个需要成为DirectoryEntry的路径。