Zotero.File.copyToUnique() (unused)

This commit is contained in:
Dan Stillman 2007-08-27 21:01:48 +00:00
parent 32cda9a696
commit 5c5addceee

View File

@ -27,6 +27,7 @@ Zotero.File = new function(){
this.getContents = getContents;
this.getContentsFromURL = getContentsFromURL;
this.putContents = putContents;
this.copyToUnique = this.copyToUnique;
this.getCharsetFromFile = getCharsetFromFile;
this.addCharsetListener = addCharsetListener;
@ -147,6 +148,17 @@ Zotero.File = new function(){
}
function copyToUnique(file, newFile) {
newFile.createUnique(Components.interfaces.nsIFile.NORMAL_FILE_TYPE, 0644);
var newName = newFile.leafName;
newFile.remove(null);
// Copy file to unique name
file.copyTo(newFile.parent, newName);
return file;
}
/*
* Not implemented, but it'd sure be great if it were
*/