diff --git a/rse/plugins/org.eclipse.dstore.core/src/org/eclipse/dstore/core/model/ByteStreamHandler.java b/rse/plugins/org.eclipse.dstore.core/src/org/eclipse/dstore/core/model/ByteStreamHandler.java index 06d22cb7336..2f8028a8d7d 100644 --- a/rse/plugins/org.eclipse.dstore.core/src/org/eclipse/dstore/core/model/ByteStreamHandler.java +++ b/rse/plugins/org.eclipse.dstore.core/src/org/eclipse/dstore/core/model/ByteStreamHandler.java @@ -82,9 +82,9 @@ public class ByteStreamHandler implements IByteStreamHandler { // need to create directories as well File file = new File(fileName); + File parent = new File(file.getParent()); if (!file.exists()) - { - File parent = new File(file.getParent()); + { parent.mkdirs(); } else @@ -92,8 +92,11 @@ public class ByteStreamHandler implements IByteStreamHandler // backup file on upload by default String doBackups = System.getProperty("backupfiles"); //$NON-NLS-1$ if (doBackups == null || doBackups.equals("true")){ //$NON-NLS-1$ - // backup the file first - file.renameTo(new File('.'+fileName+"~")); //$NON-NLS-1$ + // backup the file first + String n = file.getName(); + File backupFile = new File(parent, '.' + n + '~'); + _dataStore.trace("Backing up as "+backupFile.getAbsolutePath()); //$NON-NLS-1$ + file.renameTo(backupFile); } }