@Test public void vfsFromDirWithJarInName() throws MalformedURLException { String tmpFolder = System.getProperty("java.io.tmpdir"); tmpFolder = tmpFolder.endsWith(File.separator) ? tmpFolder : tmpFolder + File.separator; String dirWithJarInName = tmpFolder + "tony.jarvis"; File newDir = new File(dirWithJarInName); newDir.mkdir(); try { Vfs.Dir dir = Vfs.fromURL(new URL(format("file:{0}", dirWithJarInName))); assertEquals(dirWithJarInName, dir.getPath()); assertEquals(SystemDir.class, dir.getClass()); } finally { newDir.delete(); } }
@Override public Dir createDir(URL url) throws Exception { File file = Vfs.getFile(url); if (file == null || file.exists() == false) { s_logger.warn("URL could not be resolved to a file: " + url); return new EmptyDir(file); } else { return new SystemDir(file); } }
@Override public Vfs.Dir createDir(URL url) { return new SystemDir(FileUtils.toFile(fixURL(url))); }