/** * Using the directory, namd and extension, resolve a partial to a name. * * @param dir * @param name * @param extension * @return */ public String resolvePartialPath(String dir, String name, String extension) { String filePath = name; // Do not prepend directory if it is already defined if (!name.startsWith("/")) { filePath = dir + filePath; } int sepIndex = name.lastIndexOf("/"); name = sepIndex == -1 ? name : name.substring(sepIndex); // Do not append extension if it has the same extension or original one if (!(name.endsWith(extension) || name.contains("."))) { filePath = filePath + extension; } String path = new File(filePath).getPath(); return ensureForwardSlash(path); }
/** * Using the directory, namd and extension, resolve a partial to a name. * * @param dir * @param name * @param extension * @return */ public String resolvePartialPath(String dir, String name, String extension) { String filePath = name; // Do not prepend directory if it is already defined if (!name.startsWith("/")) { filePath = dir + filePath; } // Do not append extension if it is already defined if (!name.endsWith(extension)) { filePath = filePath + extension; } String path = new File(filePath).getPath(); return ensureForwardSlash(path); }
/** * Using the directory, namd and extension, resolve a partial to a name. * * @param dir * @param name * @param extension * @return */ public String resolvePartialPath(String dir, String name, String extension) { String filePath = name; // Do not prepend directory if it is already defined if (!name.startsWith("/")) { filePath = dir + filePath; } int sepIndex = name.lastIndexOf("/"); name = sepIndex == -1 ? name : name.substring(sepIndex); // Do not append extension if it has the same extension or original one if (!(name.endsWith(extension) || name.contains("."))) { filePath = filePath + extension; } String path = new File(filePath).getPath(); return ensureForwardSlash(path); }