public String getIdentifier(final LogicalPath logicalPath, final String relativePath) { Assert.notNull(logicalPath, "Path required"); Assert.notNull(relativePath, "Relative path cannot be null, although it can be empty"); String initialPath = FileUtils.getCanonicalPath(getPath(logicalPath)); initialPath = FileUtils.ensureTrailingSeparator(initialPath); return initialPath + FileUtils.removeLeadingAndTrailingSeparators(relativePath); }
/** * Each {@link FileDetails} is known by its canonical file name, which is also the format used for * Ant path matching etc. This method provides the canonical file name without forcing the user to * deal with the exceptions that would arise from using {@link File} directly. * * @return the canonical path. */ public String getCanonicalPath() { return FileUtils.getCanonicalPath(file); }
/** * Returns the canonical path of the given {@link File}. * * @param file the file for which to find the canonical path (required) * @return the canonical path * @deprecated use {@link FileUtils#getCanonicalPath(File)} instead */ @Deprecated public static String getCanonicalPath(final File file) { return FileUtils.getCanonicalPath(file); }