@Test public void testGetCanonicalPath() { String result = FileNameUtil.getCanonicalPath("/x/y/z"); result = result.replaceAll("\\\\", "/"); assertThat(result.endsWith("/x/y/z"), CoreMatchers.is(true)); result = FileNameUtil.getCanonicalPath("build/results/./xyz"); result = result.replaceAll("\\\\", "/"); assertThat(result.endsWith("build/results/xyz"), CoreMatchers.is(true)); result = FileNameUtil.getCanonicalPath("classpath: assertThat(result, CoreMatchers.is("classpath: }
public static String getCanonicalPath(String path) { if (path.startsWith(FileSystemUtil.CLASSPATH_PREFIX)) { return path; } File file = new File(path); try { return file.getCanonicalPath(); } catch (IOException e) { throw new IllegalArgumentException("Error accessing file '" + file.getAbsolutePath() + "': ", e); } }
FileNameUtil { public static String getCanonicalPath(String path) { if (path.startsWith(FileSystemUtil.CLASSPATH_PREFIX)) { return path; } File file = new File(path); try { return file.getCanonicalPath(); } catch (IOException e) { throw new IllegalArgumentException("Error accessing file '" + file.getAbsolutePath() + "': ", e); } } }
FileNameUtil { public static String getCanonicalPath(String path) { if (path.startsWith(FileSystemUtil.CLASSPATH_PREFIX)) { return path; } File file = new File(path); try { return file.getCanonicalPath(); } catch (IOException e) { throw new IllegalArgumentException("Error accessing file '" + file.getAbsolutePath() + "': ", e); } } private  FileNameUtil(); }
FileNameUtil { public static String getCanonicalPath(String path) { if (path.startsWith(FileSystemUtil.CLASSPATH_PREFIX)) { return path; } File file = new File(path); try { return file.getCanonicalPath(); } catch (IOException e) { throw new IllegalArgumentException("Error accessing file '" + file.getAbsolutePath() + "': ", e); } } private  FileNameUtil(); static List<File> identifyFiles(Map parameters); static boolean isIncluded(String name, Map parameters); static boolean matches(String name, List<String> patterns, boolean defaultValue); static boolean matches(String name, String pattern); static String getParentPath(String fileName); static String getCanonicalPath(String path); }
FileNameUtil { public static String getCanonicalPath(String path) { if (path.startsWith(FileSystemUtil.CLASSPATH_PREFIX)) { return path; } File file = new File(path); try { return file.getCanonicalPath(); } catch (IOException e) { throw new IllegalArgumentException("Error accessing file '" + file.getAbsolutePath() + "': ", e); } } private  FileNameUtil(); static List<File> identifyFiles(Map parameters); static boolean isIncluded(String name, Map parameters); static boolean matches(String name, List<String> patterns, boolean defaultValue); static boolean matches(String name, String pattern); static String getParentPath(String fileName); static String getCanonicalPath(String path);  }