Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorUwe Stieber2014-10-21 08:33:09 +0000
committerUwe Stieber2014-10-21 08:33:09 +0000
commit3ee9cc76a68b44121001578e9fd1e995e48eeb82 (patch)
tree6687e8d8f0f9008f1fde779f6c4fa09e198a422e /target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.core
parent0e68eb901340431bd902944246a6bd100b5fccd2 (diff)
downloadorg.eclipse.tcf-3ee9cc76a68b44121001578e9fd1e995e48eeb82.tar.gz
org.eclipse.tcf-3ee9cc76a68b44121001578e9fd1e995e48eeb82.tar.xz
org.eclipse.tcf-3ee9cc76a68b44121001578e9fd1e995e48eeb82.zip
Target Explorer: FileTransferService.transferToTarget now also creates missing directories
Diffstat (limited to 'target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.core')
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/services/FileTransferService.java49
1 files changed, 43 insertions, 6 deletions
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/services/FileTransferService.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/services/FileTransferService.java
index ec5fcced8..e0d023b3a 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/services/FileTransferService.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/services/FileTransferService.java
@@ -254,14 +254,51 @@ public class FileTransferService {
final FileAttrs[] attrs = new FileAttrs[1];
// Check the target destination directory
+ for (int i = 0; i < targetPath.segmentCount(); i++) {
+ IPath tp = i + 1 < targetPath.segmentCount() ? targetPath.removeLastSegments(targetPath.segmentCount() - (i + 1)) : targetPath;
- fileSystem.stat(targetPath.toString(), new IFileSystem.DoneStat() {
- @Override
- public void doneStat(IToken token, FileSystemException e, FileAttrs a) {
- error[0] = e;
- attrs[0] = a;
+ error[0] = null;
+ attrs[0] = null;
+
+ fileSystem.stat(tp.toString(), new IFileSystem.DoneStat() {
+ @Override
+ public void doneStat(IToken token, FileSystemException e, FileAttrs a) {
+ error[0] = e;
+ attrs[0] = a;
+ }
+ });
+
+ if (attrs[0] == null && i + 1 < targetPath.segmentCount()) {
+ error[0] = null;
+ attrs[0] = null;
+
+ fileSystem.mkdir(tp.toString(), null, new IFileSystem.DoneMkDir() {
+ @Override
+ public void doneMkDir(IToken token, FileSystemException e) {
+ error[0] = e;
+ }
+ });
+
+ if (error[0] != null) {
+ result = StatusHelper.getStatus(error[0]);
+ if (callback != null) callback.done(peer, result);
+ return;
+ }
+
+ // Read the attributes of the created directory
+ error[0] = null;
+ attrs[0] = null;
+
+ fileSystem.stat(tp.toString(), new IFileSystem.DoneStat() {
+ @Override
+ public void doneStat(IToken token, FileSystemException e, FileAttrs a) {
+ error[0] = e;
+ attrs[0] = a;
+ }
+ });
}
- });
+ }
+
// If we get the attributes back, the name at least exist in the target file system
if (attrs[0] != null && attrs[0].isDirectory()) {
targetPath = targetPath.append(item.getHostPath().lastSegment());

Back to the top