mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-08-16 12:45:41 +02:00
[367424] [dstore] upload mechanism should provide backups of files
-ammendment to backup renaming
This commit is contained in:
parent
0455f0b994
commit
58f79d1be1
1 changed files with 7 additions and 4 deletions
|
@ -82,9 +82,9 @@ public class ByteStreamHandler implements IByteStreamHandler
|
||||||
{
|
{
|
||||||
// need to create directories as well
|
// need to create directories as well
|
||||||
File file = new File(fileName);
|
File file = new File(fileName);
|
||||||
|
File parent = new File(file.getParent());
|
||||||
if (!file.exists())
|
if (!file.exists())
|
||||||
{
|
{
|
||||||
File parent = new File(file.getParent());
|
|
||||||
parent.mkdirs();
|
parent.mkdirs();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -92,8 +92,11 @@ public class ByteStreamHandler implements IByteStreamHandler
|
||||||
// backup file on upload by default
|
// backup file on upload by default
|
||||||
String doBackups = System.getProperty("backupfiles"); //$NON-NLS-1$
|
String doBackups = System.getProperty("backupfiles"); //$NON-NLS-1$
|
||||||
if (doBackups == null || doBackups.equals("true")){ //$NON-NLS-1$
|
if (doBackups == null || doBackups.equals("true")){ //$NON-NLS-1$
|
||||||
// backup the file first
|
// backup the file first
|
||||||
file.renameTo(new File('.'+fileName+"~")); //$NON-NLS-1$
|
String n = file.getName();
|
||||||
|
File backupFile = new File(parent, '.' + n + '~');
|
||||||
|
_dataStore.trace("Backing up as "+backupFile.getAbsolutePath()); //$NON-NLS-1$
|
||||||
|
file.renameTo(backupFile);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue