View | Details | Raw Unified | Return to bug 39373
Collapse All | Expand All

(-)apache-ant-1.7.0Beta2/src/main/org/apache/tools/ant/taskdefs/optional/ssh/ScpFromMessageBySftp.java (-2 / +19 lines)
Lines 115-120 Link Here
115
                pwd=remoteFile.substring(0, remoteFile.lastIndexOf('/'));
115
                pwd=remoteFile.substring(0, remoteFile.lastIndexOf('/'));
116
            }
116
            }
117
        }
117
        }
118
        String cwd=channel.pwd();
118
        channel.cd(pwd);
119
        channel.cd(pwd);
119
        if (!localFile.exists()) {
120
        if (!localFile.exists()) {
120
            localFile.mkdirs();
121
            localFile.mkdirs();
Lines 123-129 Link Here
123
        for(int i = 0; i < files.size(); i++){
124
        for(int i = 0; i < files.size(); i++){
124
            ChannelSftp.LsEntry le = (ChannelSftp.LsEntry) files.elementAt(i);
125
            ChannelSftp.LsEntry le = (ChannelSftp.LsEntry) files.elementAt(i);
125
            String name = le.getFilename();
126
            String name = le.getFilename();
126
            if (le.getAttrs().isDir()) {
127
            SftpATTRS attrs = le.getAttrs();
128
129
            /*
130
            // SftpATTRS#isLink() has been added at jsch 0.1.28.
131
            // If Ant 1.7 can force to use such recent jsch version,
132
            // we can use it.
133
            if(attrs.isLink()){
134
              attrs=channel.stat(name);
135
            }
136
            */
137
138
            if((attrs.getFlags()&SftpATTRS.SSH_FILEXFER_ATTR_PERMISSIONS)!=0 &&
139
               (attrs.getPermissions()&0xa000)==0xa000){
140
              attrs=channel.stat(name);
141
            }
142
143
            if (attrs.isDir()) {
127
                if (name.equals(".") || name.equals("..")) {
144
                if (name.equals(".") || name.equals("..")) {
128
                    continue;
145
                    continue;
129
                }
146
                }
Lines 134-140 Link Here
134
                getFile(channel, le, localFile);
151
                getFile(channel, le, localFile);
135
            }
152
            }
136
        }
153
        }
137
        channel.cd("..");
154
        channel.cd(cwd);
138
    }
155
    }
139
156
140
    private void getFile(ChannelSftp channel, 
157
    private void getFile(ChannelSftp channel, 

Return to bug 39373