1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-19 06:55:23 +02:00

[367424] [dstore] upload mechanism should provide backups of files

This commit is contained in:
David McKnight 2012-03-20 20:12:00 +00:00
parent 868e39217c
commit de60a4e93c

View file

@ -96,9 +96,12 @@ public class ByteStreamHandler implements IByteStreamHandler
String n = file.getName(); String n = file.getName();
File backupFile = new File(parent, '.' + n + '~'); File backupFile = new File(parent, '.' + n + '~');
_dataStore.trace("Backing up as "+backupFile.getAbsolutePath()); //$NON-NLS-1$ _dataStore.trace("Backing up as "+backupFile.getAbsolutePath()); //$NON-NLS-1$
if(!file.renameTo(backupFile) && backupFile.exists()) {
backupFile.delete();
file.renameTo(backupFile); file.renameTo(backupFile);
} }
} }
}
File newFile = new File(fileName); File newFile = new File(fileName);
FileOutputStream fileStream = new FileOutputStream(newFile); FileOutputStream fileStream = new FileOutputStream(newFile);