@Override public File resolvePath(String path) { File file = new File(path); if (!file.isAbsolute()) { try { file = new File(baseDir(), path).getCanonicalFile(); } catch (IOException e) { throw new IllegalArgumentException("Unable to resolve path '" + path + "'", e); } } return file; } }
@Test public void test_directories() throws Exception { assertThat(fs.baseDir()).isAbsolute().isDirectory().exists(); assertThat(fs.baseDir().getCanonicalPath()).isEqualTo(basedir.getCanonicalPath()); File workdir = temp.newFolder(); fs.setWorkDir(workdir.toPath()); assertThat(fs.workDir()).isAbsolute().isDirectory().exists(); assertThat(fs.workDir().getCanonicalPath()).isEqualTo(workdir.getCanonicalPath()); }
@Test public void testFs() throws Exception { DefaultFileSystem fs = new DefaultFileSystem(temp.newFolder()); tester.setFileSystem(fs); assertThat(tester.fileSystem().baseDir()).isNotEqualTo(baseDir); }
@Override public File resolvePath(String path) { File file = new File(path); if (!file.isAbsolute()) { try { file = new File(baseDir(), path).getCanonicalFile(); } catch (IOException e) { throw new IllegalArgumentException("Unable to resolve path '" + path + "'", e); } } return file; } }
@Override public File resolvePath(String path) { File file = new File(path); if (!file.isAbsolute()) { try { file = new File(baseDir(), path).getCanonicalFile(); } catch (IOException e) { throw new IllegalArgumentException("Unable to resolve path '" + path + "'", e); } } return file; } }