private boolean isHidden(Path path) throws IOException { if (SystemUtils.IS_OS_WINDOWS) { try { DosFileAttributes dosFileAttributes = Files.readAttributes(path, DosFileAttributes.class, LinkOption.NOFOLLOW_LINKS); return dosFileAttributes.isHidden(); } catch (UnsupportedOperationException e) { return path.toFile().isHidden(); } } else { return Files.isHidden(path); } } }
@Override public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException { if (!Files.isHidden(file)) { fileIndexer.indexFile(module, moduleExclusionFilters, moduleCoverageAndDuplicationExclusions, file, type, progressReport, exclusionCounter, ignoreCommand); } return FileVisitResult.CONTINUE; }
/** * Creates a Swagger2MarkupConverter.Builder using a local Path. * * @param swaggerPath the local Path * @return a Swagger2MarkupConverter */ public static Builder from(Path swaggerPath) { Validate.notNull(swaggerPath, "swaggerPath must not be null"); if (Files.notExists(swaggerPath)) { throw new IllegalArgumentException(String.format("swaggerPath does not exist: %s", swaggerPath)); } try { if (Files.isHidden(swaggerPath)) { throw new IllegalArgumentException("swaggerPath must not be a hidden file"); } } catch (IOException e) { throw new RuntimeException("Failed to check if swaggerPath is a hidden file", e); } return new Builder(swaggerPath); }
if (!Files.isRegularFile(path) || !Files.isReadable(path) || Files.isHidden(path)) { throw new HttpException("File is not accessible", Http.Status.FORBIDDEN_403);
/** * @param file * @return {@code true} if the given file is hidden * @throws IOException */ static boolean isHidden(File file) throws IOException { return Files.isHidden(toPath(file)); }
public boolean isHidden(Path path) { try { if (!path.startsWith(this.path)) return true; for (int i=this.path.getNameCount(); i<path.getNameCount();i++) { if (path.getName(i).toString().startsWith(".")) { return true; } } return Files.exists(path) && Files.isHidden(path); } catch (IOException e) { LOG.ignore(e); return false; } }
protected boolean accept(Path path) { try { return !Files.isHidden(path); } catch (IOException e) { return false; } }
protected boolean accept(Path path) { try { return !Files.isHidden(path); } catch (IOException e) { return false; } }
protected boolean accept(Path path) { try { return !Files.isHidden(path); } catch (IOException e) { return false; } }
/** * Invoked during iteration for omitting hidden files. */ @Override public boolean accept(final Path entry) throws IOException { return !Files.isHidden(entry); }
protected boolean accept(Path path) { try { return !Files.isHidden(path); } catch (IOException e) { return false; } }
/** * @param file * @return {@code true} if the given file is hidden * @throws IOException */ static boolean isHidden(File file) throws IOException { return Files.isHidden(file.toPath()); }
public static boolean SecurityLFI(Path dir, Path file) throws Exception { try { if (!Files.exists(file.toAbsolutePath().normalize()) || Files.isHidden(file) || !file.toAbsolutePath().normalize().startsWith(dir.toAbsolutePath())) { return false; } else { return true; } } catch (Exception e) { throw new Exception("Down failure Problem during down files:" + e.getMessage()); } }
public boolean isHidden() { try { return Files.isHidden(toPath()); } catch (IOException exception) { return false; } }
@Override public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException { if (!Files.isHidden(file)) { fileIndexer.indexFile(module, moduleExclusionFilters, moduleCoverageAndDuplicationExclusions, file, type, progressReport, excludedByPatternsCount); } return FileVisitResult.CONTINUE; }
private static boolean isValidAppArtifact(Path appPath) throws CarbonDeploymentException { try { return Files.exists(appPath) && Files.isDirectory(appPath) && Files.isReadable(appPath) && !Files.isHidden(appPath); } catch (IOException e) { throw new CarbonDeploymentException("Cannot access web app artifact in '" + appPath + "'.", e); } }
@Override public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException { if (!Files.isHidden(file)) { Path r = dir.relativize(file); if (matcher.matches(r)) { stream.add(file); } } return FileVisitResult.CONTINUE; }
@Override public FileVisitResult preVisitDirectory(Path dir, BasicFileAttributes attrs) throws IOException { if (Files.isHidden(dir)) { LOGGER.debug("Ignoring hidden directory: " + dir.toString()); return FileVisitResult.SKIP_SUBTREE; } return super.preVisitDirectory(dir, attrs); } }
@Override public LocalFolder scanFolder(Path path, LocalFolderScannerContext context) { try { if (Files.isDirectory(path) && !Files.isHidden(path)) { return new DefaultLocalFolder(path, context.getRootDir(), context.getFileSystemName()); } } catch (IOException e) { throw new UncheckedIOException(e); } return null; } }
@Test @Category( { Windows.class, DosAttributesT.class, Writable.class } ) public void testWindowsIsHidden() throws IOException { assertThat( Files.isHidden( fileTA() ) ).isFalse(); Files.getFileAttributeView( absTA(), DosFileAttributeView.class ).setHidden( true ); assertThat( Files.isHidden( fileTA() ) ).isTrue(); Files.setAttribute( absTA(), "dos:hidden", false ); assertThat( Files.isHidden( fileTA() ) ).isFalse(); }