/** * Breaks a path up into a Vector of path elements, tokenizing on * * @param path Path to tokenize. Must not be <code>null</code>. * @param separator the separator against which to tokenize. * * @return a Vector of path elements from the tokenized path * @since Ant 1.6 */ public static Vector<String> tokenizePath(String path, String separator) { Vector<String> ret = new Vector<>(); if (FileUtils.isAbsolutePath(path)) { String[] s = FILE_UTILS.dissect(path); ret.add(s[0]); path = s[1]; } StringTokenizer st = new StringTokenizer(path, separator); while (st.hasMoreTokens()) { ret.addElement(st.nextToken()); } return ret; }
/** * true if the pattern specifies a relative path without basedir * or an absolute path not inside basedir. * * @since Ant 1.8.0 */ private boolean shouldSkipPattern(final String pattern) { if (FileUtils.isAbsolutePath(pattern)) { //skip abs. paths not under basedir, if set: return !(basedir == null || SelectorUtils.matchPatternStart(pattern, basedir.getAbsolutePath(), isCaseSensitive())); } return basedir == null; }
if (!isAbsolutePath(path)) { throw new BuildException(path + " is not an absolute path");
if (FileUtils.isAbsolutePath(path)) { String[] s = FILE_UTILS.dissect(path); root = s[0];
/** * Constructs a file path from a <code>file:</code> URI. * * <p>Will be an absolute path if the given URI is absolute.</p> * * <p>Swallows '%' that are not followed by two characters, * doesn't deal with non-ASCII characters.</p> * * @param uri the URI designating a file in the local filesystem. * @return the local file system path for the file. * @since Ant 1.6 */ public String fromURI(String uri) { synchronized (cacheFromUriLock) { if (uri.equals(cacheFromUriRequest)) { return cacheFromUriResponse; } String path = Locator.fromURI(uri); String ret = isAbsolutePath(path) ? normalize(path).getAbsolutePath() : path; cacheFromUriRequest = uri; cacheFromUriResponse = ret; return ret; } }
if (!isAbsolutePath(filename)) { char sep = File.separatorChar; filename = filename.replace('/', sep).replace('\\', sep);
/** * From <code>base</code> traverse the filesystem in order to find * a file that matches the given name. * * @param base base File (dir). * @param cs whether to scan case-sensitively. * @return File object that points to the file in question or null. */ public File findFile(File base, final boolean cs) { String[] tokens = tokenizedPath; if (FileUtils.isAbsolutePath(path)) { if (base == null) { String[] s = FILE_UTILS.dissect(path); base = new File(s[0]); tokens = SelectorUtils.tokenizePathAsArray(s[1]); } else { File f = FILE_UTILS.normalize(path); String s = FILE_UTILS.removeLeadingPath(base, f); if (s.equals(f.getAbsolutePath())) { //removing base from path yields no change; path //not child of base return null; } tokens = SelectorUtils.tokenizePathAsArray(s); } } return findFile(base, tokens, cs); }
TokenizedPath currentPath = entry.getKey(); String currentelement = currentPath.toString(); if (basedir == null && !FileUtils.isAbsolutePath(currentelement)) { continue;
protected static File getAbsoluteFile(final String filePath) { final File file; if (FileUtils.isAbsolutePath(filePath)) { file = new File(filePath); } else { file = new File(new File(System.getProperty("user.dir")), filePath); } try { return file.getCanonicalFile(); } catch (IOException e) { return file; } } }
if (!FileUtils.isAbsolutePath(s)) { moduleDir = new File(new File(applicationDir, "conf"), s); } else {
fFile = attributes.getValue(IAntCoreConstants.DIR); if (fFile != null) { if (!FileUtils.isAbsolutePath(fFile)) { File basedir = task.getProject().getBaseDir(); if (basedir != null) { if (fFile == null || FileUtils.isAbsolutePath(fileName)) { fFile = fileName; } else {