@Test public void testDefaultPath() throws Exception { assertEquals("/", new FTPWorkdirService(session).find().getAbsolute()); }
@Override public Path find() throws BackgroundException { final Path home = super.find(); if(home == DEFAULT_HOME) { final String directory; try { directory = session.getClient().printWorkingDirectory(); if(null == directory) { throw new FTPException(session.getClient().getReplyCode(), session.getClient().getReplyString()); } return new Path(PathNormalizer.normalize(directory), directory.equals(String.valueOf(Path.DELIMITER)) ? EnumSet.of(Path.Type.volume, Path.Type.directory) : EnumSet.of(Path.Type.directory)); } catch(IOException e) { throw new FTPExceptionMappingService().map(e); } } return home; }
FTPWorkdirService extends DefaultHomeFinderService { @Override public Path find() throws BackgroundException { final Path home = super.find(); if(home == DEFAULT_HOME) { final String directory; try { directory = session.getClient().printWorkingDirectory(); if(null == directory) { throw new FTPException(session.getClient().getReplyCode(), session.getClient().getReplyString()); } return new Path(PathNormalizer.normalize(directory), directory.equals(String.valueOf(Path.DELIMITER)) ? EnumSet.of(Path.Type.volume, Path.Type.directory) : EnumSet.of(Path.Type.directory)); } catch(IOException e) { throw new FTPExceptionMappingService().map(e); } } return home; } }
FTPWorkdirService extends DefaultHomeFinderService { @Override public Path find() throws BackgroundException { final Path home = super.find(); if(home == DEFAULT_HOME) { final String directory; try { directory = session.getClient().printWorkingDirectory(); if(null == directory) { throw new FTPException(session.getClient().getReplyCode(), session.getClient().getReplyString()); } return new Path(PathNormalizer.normalize(directory), directory.equals(String.valueOf(Path.DELIMITER)) ? EnumSet.of(Path.Type.volume, Path.Type.directory) : EnumSet.of(Path.Type.directory)); } catch(IOException e) { throw new FTPExceptionMappingService().map(e); } } return home; } FTPWorkdirService(final FTPSession session); }
FTPWorkdirService extends DefaultHomeFinderService { @Override public Path find() throws BackgroundException { final Path home = super.find(); if(home == DEFAULT_HOME) { final String directory; try { directory = session.getClient().printWorkingDirectory(); if(null == directory) { throw new FTPException(session.getClient().getReplyCode(), session.getClient().getReplyString()); } return new Path(PathNormalizer.normalize(directory), directory.equals(String.valueOf(Path.DELIMITER)) ? EnumSet.of(Path.Type.volume, Path.Type.directory) : EnumSet.of(Path.Type.directory)); } catch(IOException e) { throw new FTPExceptionMappingService().map(e); } } return home; } FTPWorkdirService(final FTPSession session); @Override Path find(); }
FTPWorkdirService extends DefaultHomeFinderService { @Override public Path find() throws BackgroundException { final Path home = super.find(); if(home == DEFAULT_HOME) { final String directory; try { directory = session.getClient().printWorkingDirectory(); if(null == directory) { throw new FTPException(session.getClient().getReplyCode(), session.getClient().getReplyString()); } return new Path(PathNormalizer.normalize(directory), directory.equals(String.valueOf(Path.DELIMITER)) ? EnumSet.of(Path.Type.volume, Path.Type.directory) : EnumSet.of(Path.Type.directory)); } catch(IOException e) { throw new FTPExceptionMappingService().map(e); } } return home; } FTPWorkdirService(final FTPSession session); @Override Path find();  }