ch.cyberduck.core.Path.isSymbolicLink()方法的使用及代码示例

x33g5p2x  于2022-01-26 转载在 其他  
字(8.3k)|赞(0)|评价(0)|浏览(193)

本文整理了Java中ch.cyberduck.core.Path.isSymbolicLink()方法的一些代码示例,展示了Path.isSymbolicLink()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Path.isSymbolicLink()方法的具体详情如下:
包路径:ch.cyberduck.core.Path
类名称:Path
方法名:isSymbolicLink

Path.isSymbolicLink介绍

暂无

代码示例

代码示例来源:origin: iterate-ch/cyberduck

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();
}

代码示例来源:origin: iterate-ch/cyberduck

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());
}

代码示例来源:origin: iterate-ch/cyberduck

if(file.isSymbolicLink()) {
  Files.delete(p);
  options.add(StandardOpenOption.CREATE);

代码示例来源:origin: iterate-ch/cyberduck

@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;
  }
}

代码示例来源:origin: iterate-ch/cyberduck

@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);
      }
    }
  }
}

代码示例来源:origin: iterate-ch/cyberduck

if(file.isSymbolicLink()) {

代码示例来源:origin: iterate-ch/cyberduck

protected boolean post(final Path file) throws BackgroundException {
  if(file.isSymbolicLink()) {
    final Path target;
    Path.Type type;

代码示例来源:origin: iterate-ch/cyberduck

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())) {

代码示例来源:origin: iterate-ch/cyberduck

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;
}

代码示例来源:origin: iterate-ch/cyberduck

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()) {

代码示例来源:origin: iterate-ch/cyberduck

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;
}

代码示例来源:origin: iterate-ch/cyberduck

log.debug(String.format("Transfer file %s with options %s", file, options));
if(file.isSymbolicLink()) {
  if(symlinkResolver.resolve(file)) {

代码示例来源:origin: iterate-ch/cyberduck

@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);
      }
    }
  }
}

代码示例来源:origin: iterate-ch/cyberduck

if(file.isSymbolicLink()) {
  stat = session.sftp().lstat(file.getAbsolute());

代码示例来源:origin: iterate-ch/cyberduck

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;
}

代码示例来源:origin: iterate-ch/cyberduck

if(file.isSymbolicLink()) {

代码示例来源:origin: iterate-ch/cyberduck

if(file.isSymbolicLink()) {
  path = file.getSymlinkTarget().getAbsolute();

代码示例来源:origin: iterate-ch/cyberduck

@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());
  }
}

代码示例来源:origin: iterate-ch/cyberduck

@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);
    }
  }
}

代码示例来源:origin: iterate-ch/cyberduck

if(file.isSymbolicLink()) {
  final NSImage badge = this.iconNamed("aliasbadge.tiff", size);
  badge.setName("aliasbadge");

相关文章