public SimplePathPredicate(final Path file) { this.file = file; this.type = file.isSymbolicLink() ? Path.Type.symboliclink : file.isFile() ? Path.Type.file : Path.Type.directory; this.path = file.getAbsolute(); }
public CaseInsensitivePathPredicate(final Path file) { this.type = file.isSymbolicLink() ? Path.Type.symboliclink : file.isFile() ? Path.Type.file : Path.Type.directory; this.path = StringUtils.lowerCase(file.getAbsolute()); }
if(file.isSymbolicLink()) { Files.delete(p); options.add(StandardOpenOption.CREATE);
@Override public List<TransferItem> list(final Session<?> session, final Path directory, final Local local, final ListProgressListener listener) throws BackgroundException { if(log.isDebugEnabled()) { log.debug(String.format("List children for %s", directory)); } if(directory.isSymbolicLink() && new DownloadSymlinkResolver(roots).resolve(directory)) { if(log.isDebugEnabled()) { log.debug(String.format("Do not list children for symbolic link %s", directory)); } return Collections.emptyList(); } else { final AttributedList<Path> list; if(cache.isCached(directory)) { list = cache.get(directory); } else { list = session.getFeature(ListService.class).list(directory, listener); cache.put(directory, list); } final List<TransferItem> children = new ArrayList<TransferItem>(); // Return copy with filtered result only for(Path f : new AttributedList<Path>(list.filter(comparator, filter))) { children.add(new TransferItem(f, LocalFactory.get(local, f.getName()))); } return children; } }
@Override public void delete(final List<Path> files, final PasswordCallback prompt, final Callback callback) throws BackgroundException { for(Path file : files) { if(file.isFile() || file.isSymbolicLink()) { callback.delete(file); try { Files.delete(session.toPath(file)); } catch(IOException e) { throw new LocalExceptionMappingService().map("Cannot delete {0}", e, file); } } } for(Path file : files) { if(file.isDirectory() && !file.isSymbolicLink()) { callback.delete(file); try { Files.delete(session.toPath(file)); } catch(IOException e) { throw new LocalExceptionMappingService().map("Cannot delete {0}", e, file); } } } }
if(file.isSymbolicLink()) {
protected boolean post(final Path file) throws BackgroundException { if(file.isSymbolicLink()) { final Path target; Path.Type type;
final Set<Path> removal = new HashSet<>(); for(final Path file : list) { if(file.isSymbolicLink()) { final Path target = file.getSymlinkTarget(); if(session.getClient().changeWorkingDirectory(file.getAbsolute())) {
protected Map<Path, Path> compile(final Copy copy, final ListService list, final Path source, final Path target) throws BackgroundException { // Compile recursive list final Map<Path, Path> recursive = new LinkedHashMap<>(); if(source.isFile() || source.isSymbolicLink()) { recursive.put(source, target); } else if(source.isDirectory()) { // Add parent before children recursive.put(source, target); if(!copy.isRecursive(source, target)) { // sort ascending by timestamp to copy older versions first final AttributedList<Path> children = list.list(source, new WorkerListProgressListener(this, listener)). filter(new TimestampComparator(true)); for(Path child : children) { if(this.isCanceled()) { throw new ConnectionCanceledException(); } recursive.putAll(this.compile(copy, list, child, new Path(target, child.getName(), child.getType()))); } } } return recursive; }
protected Set<Path> compile(final Host host, final Delete delete, final ListService list, final ListProgressListener listener, final Path file) throws BackgroundException { if(file.isFile() || file.isSymbolicLink()) { final Path copy = new Path(file); switch(host.getProtocol().getType()) {
public DefaultPathPredicate(final Path file) { final Path.Type type = file.isSymbolicLink() ? Path.Type.symboliclink : file.isFile() ? Path.Type.file : Path.Type.directory; String qualifier = StringUtils.EMPTY; if(StringUtils.isNotBlank(file.attributes().getRegion())) { if(new PathContainerService().isContainer(file)) { qualifier += file.attributes().getRegion(); } } if(file.isFile()) { if(StringUtils.isNotBlank(file.attributes().getVersionId())) { qualifier += file.attributes().getVersionId(); } } final String path = file.getAbsolute(); reference = "[" + type + "]" + "-" + qualifier + path; }
log.debug(String.format("Transfer file %s with options %s", file, options)); if(file.isSymbolicLink()) { if(symlinkResolver.resolve(file)) {
@Override public void delete(final List<Path> files, final PasswordCallback prompt, final Callback callback) throws BackgroundException { for(Path file : files) { if(file.isFile() || file.isSymbolicLink()) { callback.delete(file); try { session.sftp().remove(file.getAbsolute()); } catch(IOException e) { throw new SFTPExceptionMappingService().map("Cannot delete {0}", e, file); } } } for(Path file : files) { if(file.isDirectory() && !file.isSymbolicLink()) { callback.delete(file); try { session.sftp().removeDir(file.getAbsolute()); } catch(IOException e) { throw new SFTPExceptionMappingService().map("Cannot delete {0}", e, file); } } } }
if(file.isSymbolicLink()) { stat = session.sftp().lstat(file.getAbsolute());
public AbstractEditor(final Application application, final SessionPool session, final Path file, final ApplicationLauncher launcher, final ApplicationFinder finder, final ProgressListener listener) { this.applicationLauncher = launcher; this.applicationFinder = finder; this.application = application; if(file.isSymbolicLink() && PreferencesFactory.get().getBoolean("editor.upload.symboliclink.resolve")) { this.remote = file.getSymlinkTarget(); } else { this.remote = file; } this.local = TemporaryFileServiceFactory.get().create(session.getHost().getUuid(), remote); this.session = session; this.listener = listener; }
if(file.isSymbolicLink()) {
if(file.isSymbolicLink()) { path = file.getSymlinkTarget().getAbsolute();
@Override public void visit(final AttributedList<Path> list, final int index, final Path file) { if(l) { if(file.isSymbolicLink()) { console.printf("%n%sl%s\t%s\t%s -> %s%s", Ansi.ansi().bold(), file.attributes().getPermission().getSymbol(), formatter.getMediumFormat( file.attributes().getModificationDate()), file.getName(), file.getSymlinkTarget().getAbsolute(), Ansi.ansi().reset()); } else { console.printf("%n%s%s%s\t%s\t%s\t%s%s", Ansi.ansi().bold(), file.isDirectory() ? "d" : "-", file.attributes().getPermission().getSymbol(), formatter.getMediumFormat( file.attributes().getModificationDate()), StringUtils.isNotBlank(file.attributes().getRegion()) ? file.attributes().getRegion() : StringUtils.EMPTY, file.getName(), Ansi.ansi().reset()); } } else { console.printf("%n%s%s%s", Ansi.ansi().bold(), file.getName(), Ansi.ansi().reset()); } }
@Override public void delete(final List<Path> files, final PasswordCallback prompt, final Callback callback) throws BackgroundException { for(Path file : files) { callback.delete(file); try { if(file.isFile() || file.isSymbolicLink()) { if(!session.getClient().deleteFile(file.getAbsolute())) { throw new FTPException(session.getClient().getReplyCode(), session.getClient().getReplyString()); } } else if(file.isDirectory()) { // Change working directory to parent if(!session.getClient().changeWorkingDirectory(file.getParent().getAbsolute())) { throw new FTPException(session.getClient().getReplyCode(), session.getClient().getReplyString()); } if(!session.getClient().removeDirectory(file.getAbsolute())) { throw new FTPException(session.getClient().getReplyCode(), session.getClient().getReplyString()); } } } catch(IOException e) { throw new FTPExceptionMappingService().map("Cannot delete {0}", e, file); } } }
if(file.isSymbolicLink()) { final NSImage badge = this.iconNamed("aliasbadge.tiff", size); badge.setName("aliasbadge");