本文整理了Java中org.apache.tools.ant.util.FileUtils.isAbsolutePath()
方法的一些代码示例,展示了FileUtils.isAbsolutePath()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。FileUtils.isAbsolutePath()
方法的具体详情如下:
包路径:org.apache.tools.ant.util.FileUtils
类名称:FileUtils
方法名:isAbsolutePath
[英]Verifies that the specified filename represents an absolute path. Differs from new java.io.File("filename").isAbsolute() in that a path beginning with a double file separator--signifying a Windows UNC--must at minimum match "\a\b" to be considered an absolute path.
[中]验证指定的文件名是否表示绝对路径。与新java不同。木卫一。文件(“文件名”)。isAbsolute(),因为以双文件分隔符(表示Windows UNC)开头的路径必须至少匹配“\a\b”才能视为绝对路径。
代码示例来源:origin: org.apache.ant/ant
/**
* 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;
}
代码示例来源:origin: org.apache.ant/ant
/**
* 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;
}
代码示例来源:origin: org.apache.ant/ant
if (!isAbsolutePath(path)) {
throw new BuildException(path + " is not an absolute path");
代码示例来源:origin: org.apache.ant/ant
if (FileUtils.isAbsolutePath(path)) {
String[] s = FILE_UTILS.dissect(path);
root = s[0];
代码示例来源:origin: org.apache.ant/ant
/**
* 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;
}
}
代码示例来源:origin: org.apache.ant/ant
if (!isAbsolutePath(filename)) {
char sep = File.separatorChar;
filename = filename.replace('/', sep).replace('\\', sep);
代码示例来源:origin: org.apache.ant/ant
/**
* 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);
}
代码示例来源:origin: org.apache.ant/ant
TokenizedPath currentPath = entry.getKey();
String currentelement = currentPath.toString();
if (basedir == null && !FileUtils.isAbsolutePath(currentelement)) {
continue;
代码示例来源:origin: Jasig/uPortal
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;
}
}
}
代码示例来源:origin: com.google.code.maven-play-plugin.org.playframework/play
if (!FileUtils.isAbsolutePath(s)) {
moduleDir = new File(new File(applicationDir, "conf"), s);
} else {
代码示例来源:origin: org.eclipse.platform/org.eclipse.ant.ui
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 {
内容来源于网络,如有侵权,请联系作者删除!