private Path getMainPath(Path path) { return path.resolveSibling(util.getFileName(path).substring(1)); }
public static Path undot(final Path path) { if (!path.getFileName().toString().startsWith(".")) { return path; } return path.resolveSibling(path.getFileName().toString().substring(1)); }
public static Path dot(final Path path) { if (path.getFileName() == null) { return path.resolve(".root"); } return path.resolveSibling("." + path.getFileName()); }
public static Path dot(final Path path) { if (path.getFileName() == null) { return path.resolve(".root"); } return path.resolveSibling("." + path.getFileName()); }
@Test public void resolveSiblingPath() { final Path path = GeneralPathImpl.create(fs, "/path/to/file.txt", false); assertThatThrownBy(() -> path.resolveSibling((Path) null)) .isInstanceOf(IllegalArgumentException.class) .hasMessage("Parameter named 'other' should be not null!"); }
public Path buildTargetPath(Path originalPath, String targetFileName) { final org.uberfire.java.nio.file.Path _originalPath = Paths.convert(originalPath); String extension = ""; if (!Files.isDirectory(_originalPath)) { extension = getExtension(originalPath.getFileName()); } return Paths.convert(_originalPath.resolveSibling(targetFileName + extension)); }
public Path buildTargetPath(Path originalPath, String targetFileName) { final org.uberfire.java.nio.file.Path _originalPath = Paths.convert(originalPath); String extension = ""; if (!Files.isDirectory(_originalPath)) { extension = getExtension(originalPath.getFileName()); } return Paths.convert(_originalPath.resolveSibling(targetFileName + extension)); }
@Test(expected = NoSuchFileException.class) public void readAttributesNoSuchFileException() { final Path path = getDirectoryPath().resolveSibling("somethingXXX"); ioService().deleteIfExists(path); ioService().readAttributes(path); } }
@Test(expected = NoSuchFileException.class) public void readAttributesNoSuchFileException() { final Path path = getDirectoryPath().resolveSibling("somethingXXX"); ioService().deleteIfExists(path); ioService().readAttributes(path); } }
@Test(expected = FileAlreadyExistsException.class) public void createDirectoryFileAlreadyExistsException() { final Path path = getDirectoryPath().resolveSibling("otherDir"); ioService().deleteIfExists(path); ioService().createDirectory(path); ioService().createDirectory(path); }
@Test(expected = FileAlreadyExistsException.class) public void createDirectoryFileAlreadyExistsException() { final Path path = getDirectoryPath().resolveSibling("otherDir"); ioService().deleteIfExists(path); ioService().createDirectory(path); ioService().createDirectory(path); }
@Test(expected = FileAlreadyExistsException.class) public void newByteChannelFileAlreadyExistsException() { final Path path = getFilePath().resolveSibling("alreadyExists.txt"); ioService().deleteIfExists(path); ioService().write(path, "ooooo!"); ioService().newByteChannel(path); }
@Test(expected = FileAlreadyExistsException.class) public void newByteChannelFileAlreadyExistsException() { final Path path = getFilePath().resolveSibling("alreadyExists.txt"); ioService().deleteIfExists(path); ioService().write(path, "ooooo!"); ioService().newByteChannel(path); }
@Test(expected = DirectoryNotEmptyException.class) public void deleteIfExistsDirectoryNotEmptyException() { final Path path = getDirectoryPath().resolveSibling("dirToBugIfExists"); ioService().createDirectories(path); ioService().write(path.resolve("myFile.txt"), "ooooo!"); ioService().deleteIfExists(path); }
@Test(expected = FileAlreadyExistsException.class) public void createDirectoriesFileAlreadyExistsException() { final Path path = getDirectoryPath().resolveSibling("otherDir").resolve("innerDir"); ioService().deleteIfExists(path); ioService().createDirectories(path); ioService().createDirectories(path); }
@Test(expected = DirectoryNotEmptyException.class) public void deleteDirectoryNotEmptyException() { final Path path = getDirectoryPath().resolveSibling("dirToBug"); ioService().createDirectories(path); ioService().write(path.resolve("myFile.txt"), "ooooo!"); ioService().delete(path); }
@Test(expected = DirectoryNotEmptyException.class) public void deleteDirectoryNotEmptyException() { final Path path = getDirectoryPath().resolveSibling("dirToBug"); ioService().createDirectories(path); ioService().write(path.resolve("myFile.txt"), "ooooo!"); ioService().delete(path); }
@Test(expected = FileAlreadyExistsException.class) public void createDirectoriesFileAlreadyExistsException() { final Path path = getDirectoryPath().resolveSibling("otherDir").resolve("innerDir"); ioService().deleteIfExists(path); ioService().createDirectories(path); ioService().createDirectories(path); }
@Test(expected = FileAlreadyExistsException.class) public void copyFileAlreadyExistsException() { final Path path = getDirectoryPath().resolveSibling("alreadyExistsTest"); ioService().deleteIfExists(path); ioService().createDirectories(path); ioService().write(path.resolve("myFile.txt"), "ooooo!"); ioService().write(path.resolve("mytarget"), "xooooo!"); ioService().copy(path.resolve("myFile.txt"), path.resolve("mytarget")); }
@Test(expected = FileAlreadyExistsException.class) public void copyFileAlreadyExistsException() { final Path path = getDirectoryPath().resolveSibling("alreadyExistsTest"); ioService().deleteIfExists(path); ioService().createDirectories(path); ioService().write(path.resolve("myFile.txt"), "ooooo!"); ioService().write(path.resolve("mytarget"), "xooooo!"); ioService().copy(path.resolve("myFile.txt"), path.resolve("mytarget")); }