我正在尝试重命名phonegap中的文件,并按照他们的文档进行操作。但是,操作失败,错误代码为1":
this.rename_file = function(current_name, current_dir, new_name, success_callback) {
window.requestFileSystem(LocalFileSystem.PERSISTENT, 0, function (fileSystem) {
fileSystem.root.getFile(current_dir + current_name, null, function (file_entry) {
fileSystem.root.getDirectory(current_dir, {create: true, exclusive: false}, function (dir_entry) {
alert(current_dir + current_name);
parent_entry = new DirectoryEntry(current_name, current_dir + current_name);
file_entry.moveTo(parent_entry, new_name, function () {
alert(new_name)
success_callback();
}, rename_fail);
}, rename_fail);
}, rename_fail);
}, rename_fail);
function rename_fail(error) {
alert("Error renaming file " + error.code);
}
};
关于问题可能是什么的任何想法?文件存在,路径正确。