@Override public Path createDirectories(final Path dir, final FileAttribute<?>... attrs) throws UnsupportedOperationException, FileAlreadyExistsException, IOException, SecurityException { return Files.createDirectories(dir, attrs); }
@Test public void createDirectoriesNull() { assertThatThrownBy(() -> Files.createDirectories(null)) .isInstanceOf(IllegalArgumentException.class) .hasMessage("Parameter named 'dir' should be not null!"); }
@Override public Path createDirectories(final Path dir, final FileAttribute<?>... attrs) throws UnsupportedOperationException, FileAlreadyExistsException, IOException, SecurityException { final Path result = Files.createDirectories(dir, attrs); buildDotFile(dir, newOutputStream(dot(dir)), attrs); return result; }
@Test public void createDirectoriesFileAlreadyExists() { assertThatThrownBy(() -> Files.createDirectories(newTempDir())) .isInstanceOf(FileAlreadyExistsException.class); }
backup.add(new BackupItem(path, isChanged ? Files.readAllBytes(path) : null, isChanged)); if (!Files.exists(path.getParent())) { Files.createDirectories(path.getParent());
public static Path createAndCopyToDirectory(Path root, String dirName, String copyTree) throws IOException { Path dir = Files.createDirectories(Paths.get(root.toString(), dirName)); copyTree(Paths.get(copyTree), dir); return dir; }
public static Path createAndCopyToDirectory(Path root, String dirName, String copyTree) throws IOException { Path dir = Files.createDirectories(Paths.get(root.toString(), dirName)); copyTree(Paths.get(copyTree), dir); return dir; }
public BaseCompilerTest(String prjName) { try { mavenRepoPath = TestUtilMaven.getMavenRepo(); tmpRoot = Files.createTempDirectory("repo"); alternateSettingsAbsPath = new File("src/test/settings.xml").getAbsolutePath(); Path tmp = Files.createDirectories(Paths.get(tmpRoot.toString(), "dummy")); TestUtil.copyTree(Paths.get(prjName), tmp); info = new WorkspaceCompilationInfo(Paths.get(tmp.toUri())); } catch (Exception e) { logger.error(e.getMessage()); } }
public static String getMavenRepoDir(MavenRepos repo) { String repository; Aether defaultAether = Aether.getAether(); switch (repo) { case LOCAL: repository = defaultAether.getLocalRepository().getUrl(); break; case GLOBAL: repository = getGlobalRepo(defaultAether.getRepositories()); break; default: repository = getTempRepo(); } if (repository == null || repository.isEmpty()) { repository = getTempRepo(); } if (!Files.exists(Paths.get(repository))) { Files.createDirectories(Paths.get(repository)); } return repository; }
@Test public void createDirectories() { final Path path = newTempDir(); final Path dir = Files.createDirectories(path.resolve("myNewDir/mysubDir1/mysubDir2")); assertThat(dir).isNotNull(); assertThat(dir.toFile()).exists(); assertThat(dir.toFile()).isDirectory(); final Path file = Files.createFile(dir.resolve("new.file.txt")); assertThat(file).isNotNull(); assertThat(file.toFile()).exists(); assertThat(file.toFile()).isFile(); }