MkDirs no longer tries to create folders twice when path has trailing slash.

This commit is contained in:
Urs Reupke
2012-03-23 10:58:42 +01:00
parent 1c4781a65d
commit c627fabebd
2 changed files with 37 additions and 0 deletions

View File

@@ -90,6 +90,7 @@ public class SFTPClient
public void mkdirs(String path)
throws IOException {
final Deque<String> dirsToMake = new LinkedList<String>();
path = PathComponents.trimTrailingSeparator(path, engine.getPathHelper().getPathSeparator());
for (PathComponents current = engine.getPathHelper().getComponents(path); ;
current = engine.getPathHelper().getComponents(current.getParent())) {
final FileAttributes attrs = statExistence(current.getPath());