本文整理了Java中ch.cyberduck.core.Local.isDirectory()
方法的一些代码示例,展示了Local.isDirectory()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Local.isDirectory()
方法的具体详情如下:
包路径:ch.cyberduck.core.Local
类名称:Local
方法名:isDirectory
[英]This is only returning the correct result if the file already exists.
[中]这仅在文件已存在时返回正确的结果。
代码示例来源:origin: iterate-ch/cyberduck
@Override
public boolean accept(Local file) {
return file.isDirectory();
}
})) {
代码示例来源:origin: iterate-ch/cyberduck
@Override
public boolean accept(final Local file) {
return file.isDirectory();
}
}
代码示例来源:origin: iterate-ch/cyberduck
@Override
public int compare(final Local o1, final Local o2) {
if(o1.isDirectory() && o2.isDirectory()) {
return 0;
}
if(o1.isFile() && o2.isFile()) {
return 0;
}
if(o1.isDirectory()) {
return -1;
}
if(o2.isDirectory()) {
return 1;
}
return 0;
}
}
代码示例来源:origin: iterate-ch/cyberduck
@Override
public boolean accept(Local file) {
if(file.isDirectory()) {
return false;
}
return "ini".equals(file.getExtension());
}
})) {
代码示例来源:origin: iterate-ch/cyberduck
@Override
public boolean accept(Local file) {
if(file.isDirectory()) {
return true;
}
return "xml".equals(file.getExtension());
}
代码示例来源:origin: iterate-ch/cyberduck
public boolean panel_shouldShowFilename(ID panel, String path) {
final Local f = LocalFactory.get(path);
if(f.isDirectory()) {
return true;
}
final String extension = f.getExtension();
if(StringUtils.isEmpty(extension)) {
return false;
}
return extension.equals("app");
}
}
代码示例来源:origin: iterate-ch/cyberduck
@Override
public EnumSet<Type> getType() {
final EnumSet<Type> set = EnumSet.noneOf(Type.class);
if(this.isDirectory()) {
set.add(Type.directory);
if(this.isVolume()) {
set.add(Type.volume);
}
}
else {
set.add(Type.file);
}
if(this.isSymbolicLink()) {
set.add(Type.symboliclink);
}
return set;
}
代码示例来源:origin: iterate-ch/cyberduck
private void upload(final Host bookmark, final List<Local> files, final Path destination) {
final List<TransferItem> roots = new ArrayList<TransferItem>();
for(Local file : files) {
roots.add(new TransferItem(new Path(destination, file.getName(),
file.isDirectory() ? EnumSet.of(Path.Type.directory) : EnumSet.of(Path.Type.file)), file));
}
final TransferController t = TransferControllerFactory.get();
t.start(new UploadTransfer(bookmark, roots), new TransferOptions());
}
代码示例来源:origin: iterate-ch/cyberduck
@Override
public List<TransferItem> list(final Session<?> session, final Path remote,
final Local directory, final ListProgressListener listener) throws BackgroundException {
if(log.isDebugEnabled()) {
log.debug(String.format("List children for %s", directory));
}
if(directory.isSymbolicLink()) {
final Symlink symlink = session.getFeature(Symlink.class);
if(new UploadSymlinkResolver(symlink, roots).resolve(directory)) {
if(log.isDebugEnabled()) {
log.debug(String.format("Do not list children for symbolic link %s", directory));
}
// We can resolve the target of the symbolic link and will create a link on the remote system
// using the symlink feature of the session
return Collections.emptyList();
}
}
final List<TransferItem> children = new ArrayList<TransferItem>();
for(Local local : directory.list().filter(comparator, filter)) {
children.add(new TransferItem(new Path(remote, local.getName(),
local.isDirectory() ? EnumSet.of(Path.Type.directory) : EnumSet.of(Path.Type.file)), local));
}
return children;
}
代码示例来源:origin: iterate-ch/cyberduck
if(directory.isDirectory()) {
final PathMatcher matcher = FileSystems.getDefault().getPathMatcher(String.format("glob:%s", FilenameUtils.getName(path)));
final Set<TransferItem> items = new HashSet<TransferItem>();
代码示例来源:origin: iterate-ch/cyberduck
@Override
protected void parse(final ProtocolFactory protocols, final Local folder) throws AccessDeniedException {
for(Local child : folder.list().filter(new NullFilter<Local>() {
@Override
public boolean accept(Local file) {
if(file.isDirectory()) {
return false;
}
return "ini".equals(file.getExtension());
}
})) {
if(child.isDirectory()) {
this.parse(protocols, child);
}
else {
this.read(protocols, child);
}
}
}
代码示例来源:origin: iterate-ch/cyberduck
@Override
protected void parse(final ProtocolFactory protocols, final Local folder) throws AccessDeniedException {
for(Local child : folder.list().filter(new Filter<Local>() {
@Override
public boolean accept(Local file) {
if(file.isDirectory()) {
return true;
}
return "xml".equals(file.getExtension());
}
@Override
public Pattern toPattern() {
return Pattern.compile(".*\\.xml");
}
})) {
if(child.isDirectory()) {
this.parse(protocols, child);
}
else {
this.read(protocols, child);
}
}
}
代码示例来源:origin: iterate-ch/cyberduck
@Override
public Set<TransferItem> find(final CommandLine input, final TerminalAction action, final Path remote) {
final Local local = LocalFactory.get(input.getOptionValues(action.name())[1]);
if(StringUtils.containsAny(remote.getName(), '*')) {
// Treat asterisk as wildcard
return Collections.singleton(new TransferItem(remote.getParent(), local));
}
if(remote.isDirectory()) {
// Remote path resolves to directory
if(local.exists()) {
return Collections.singleton(new TransferItem(remote, LocalFactory.get(local, remote.getName())));
}
return Collections.singleton(new TransferItem(remote, local));
}
// Remote path resolves to file
if(local.isDirectory()) {
// Append remote filename to local target
return Collections.singleton(new TransferItem(remote, LocalFactory.get(local, remote.getName())));
}
// Keep from input
return Collections.singleton(new TransferItem(remote, local));
}
}
代码示例来源:origin: iterate-ch/cyberduck
protected TransferItem resolve(final Path remote, final Local local) {
if(local.isDirectory()) {
// Local path resolves to folder
if(remote.isDirectory()) {
// Append local name to remote target
return new TransferItem(new Path(remote, local.getName(), EnumSet.of(Path.Type.directory)), local);
}
return new TransferItem(new Path(remote.getParent(), remote.getName(), EnumSet.of(Path.Type.directory)), local);
}
// Local path resolves to file
if(remote.isDirectory()) {
// Append local name to remote target
return new TransferItem(new Path(remote, local.getName(), EnumSet.of(Path.Type.file)), local);
}
// Keep from input for file transfer
return new TransferItem(remote, local);
}
}
代码示例来源:origin: iterate-ch/cyberduck
/**
* @param pboard Pasteboard with filenames
* @return True if filenames are found in pasteboard and upload has started
*/
private boolean upload(NSPasteboard pboard) {
if(!this.isMounted()) {
return false;
}
if(pboard.availableTypeFromArray(NSArray.arrayWithObject(NSPasteboard.FilenamesPboardType)) != null) {
NSObject o = pboard.propertyListForType(NSPasteboard.FilenamesPboardType);
if(o != null) {
if(o.isKindOfClass(Rococoa.createClass("NSArray", NSArray._Class.class))) {
final NSArray elements = Rococoa.cast(o, NSArray.class);
final Path workdir = this.workdir();
final List<TransferItem> uploads = new ArrayList<TransferItem>();
for(int i = 0; i < elements.count().intValue(); i++) {
final Local local = LocalFactory.get(elements.objectAtIndex(new NSUInteger(i)).toString());
uploads.add(new TransferItem(new Path(workdir, local.getName(),
local.isDirectory() ? EnumSet.of(Path.Type.directory) : EnumSet.of(Path.Type.file)), local));
}
this.transfer(new UploadTransfer(pool.getHost(), uploads));
}
}
}
return false;
}
代码示例来源:origin: iterate-ch/cyberduck
local.isDirectory() ? EnumSet.of(Path.Type.directory) : EnumSet.of(Path.Type.file)), local
));
代码示例来源:origin: iterate-ch/cyberduck
final Local local = download.local;
if(local.exists()) {
if(local.isDirectory()) {
if(local.list().isEmpty()) {
代码示例来源:origin: iterate-ch/cyberduck
@Override
public void run() {
final NSOpenPanel panel = NSOpenPanel.openPanel();
panel.setCanChooseDirectories(file.isDirectory());
panel.setCanChooseFiles(file.isFile());
panel.setAllowsMultipleSelection(false);
panel.setMessage(MessageFormat.format(LocaleFactory.localizedString("Select {0}", "Credentials"),
file.getAbbreviatedPath()));
panel.setPrompt(LocaleFactory.localizedString("Choose"));
final NSInteger modal = panel.runModal(file.getParent().getAbsolute(), file.getName());
if(modal.intValue() == SheetCallback.DEFAULT_OPTION) {
final NSArray filenames = panel.filenames();
final NSEnumerator enumerator = filenames.objectEnumerator();
NSObject next;
while((next = enumerator.nextObject()) != null) {
selected.set(new FinderLocal(next.toString()));
}
}
panel.orderOut(null);
}
};
代码示例来源:origin: iterate-ch/cyberduck
if(local.exists()) {
if(file.getType().contains(Path.Type.file)) {
if(local.isDirectory()) {
throw new LocalAccessDeniedException(String.format("Cannot replace folder %s with file %s", local.getAbbreviatedPath(), file.getName()));
代码示例来源:origin: iterate-ch/cyberduck
final Local local = LocalFactory.get(elements.objectAtIndex(new NSUInteger(i)).toString());
roots.add(new TransferItem(new Path(destination, local.getName(),
local.isDirectory() ? EnumSet.of(Path.Type.directory) : EnumSet.of(Path.Type.file)), local));
内容来源于网络,如有侵权,请联系作者删除!