热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

hudson.FilePath.isAbsolute()方法的使用及代码示例

本文整理了Java中hudson.FilePath.isAbsolute()方法的一些代码示例,展示了FilePath.isAbsolute()

本文整理了Java中hudson.FilePath.isAbsolute()方法的一些代码示例,展示了FilePath.isAbsolute()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。FilePath.isAbsolute()方法的具体详情如下:
包路径:hudson.FilePath
类名称:FilePath
方法名:isAbsolute

FilePath.isAbsolute介绍

[英]Is the given path name an absolute path?
[中]给定的路径名是绝对路径吗?

代码示例

代码示例来源:origin: jenkinsci/jenkins

private String resolvePathIfRelative(@Nonnull FilePath base, @Nonnull String rel) {
if(isAbsolute(rel)) return rel;
if(base.isUnix()) {
// shouldn't need this replace, but better safe than sorry
return base.remote+'/'+rel.replace('\\','/');
} else {
// need this replace, see Slave.getWorkspaceFor and AbstractItem.getFullName, nested jobs on Windows
// agents will always have a rel containing at least one '/' character. JENKINS-13649
return base.remote+'\\'+rel.replace('/','\\');
}
}

代码示例来源:origin: jenkinsci/jenkins

/**
* Runs Ant glob expansion.
*
* @return
* A set of relative file names from the base directory.
*/
@Nonnull
private static String[] glob(File dir, String includes, String excludes, boolean defaultExcludes) throws IOException {
if(isAbsolute(includes))
throw new IOException("Expecting Ant GLOB pattern, but saw '"+includes+"'. See http://ant.apache.org/manual/Types/fileset.html for syntax");
FileSet fs = Util.createFileSet(dir,includes,excludes);
fs.setDefaultexcludes(defaultExcludes);
DirectoryScanner ds;
try {
ds = fs.getDirectoryScanner(new Project());
} catch (BuildException x) {
throw new IOException(x.getMessage());
}
String[] files = ds.getIncludedFiles();
return files;
}

代码示例来源:origin: org.jenkins-ci.main/jenkins-core

private String resolvePathIfRelative(@Nonnull FilePath base, @Nonnull String rel) {
if(isAbsolute(rel)) return rel;
if(base.isUnix()) {
// shouldn't need this replace, but better safe than sorry
return base.remote+'/'+rel.replace('\\','/');
} else {
// need this replace, see Slave.getWorkspaceFor and AbstractItem.getFullName, nested jobs on Windows
// agents will always have a rel containing at least one '/' character. JENKINS-13649
return base.remote+'\\'+rel.replace('/','\\');
}
}

代码示例来源:origin: org.eclipse.hudson/hudson-core

/**
* Runs Ant glob expansion.
*
* @return
* A set of relative file names from the base directory.
*/
private static String[] glob(File dir, String includes, String excludes) throws IOException {
if(isAbsolute(includes))
throw new IOException("Expecting Ant GLOB pattern, but saw '"+includes+"'. See http://ant.apache.org/manual/Types/fileset.html for syntax");
FileSet fs = Util.createFileSet(dir,includes,excludes);
DirectoryScanner ds = fs.getDirectoryScanner(new Project());
String[] files = ds.getIncludedFiles();
return files;
}

代码示例来源:origin: org.jvnet.hudson.main/hudson-core

/**
* Runs Ant glob expansion.
*
* @return
* A set of relative file names from the base directory.
*/
private static String[] glob(File dir, String includes) throws IOException {
if(isAbsolute(includes))
throw new IOException("Expecting Ant GLOB pattern, but saw '"+includes+"'. See http://ant.apache.org/manual/Types/fileset.html for syntax");
FileSet fs = Util.createFileSet(dir,includes);
DirectoryScanner ds = fs.getDirectoryScanner(new Project());
String[] files = ds.getIncludedFiles();
return files;
}

代码示例来源:origin: org.eclipse.hudson.main/hudson-core

/**
* Runs Ant glob expansion.
*
* @return
* A set of relative file names from the base directory.
*/
private static String[] glob(File dir, String includes) throws IOException {
if(isAbsolute(includes))
throw new IOException("Expecting Ant GLOB pattern, but saw '"+includes+"'. See http://ant.apache.org/manual/Types/fileset.html for syntax");
FileSet fs = Util.createFileSet(dir,includes);
DirectoryScanner ds = fs.getDirectoryScanner(new Project());
String[] files = ds.getIncludedFiles();
return files;
}

代码示例来源:origin: hudson/hudson-2.x

/**
* Runs Ant glob expansion.
*
* @return
* A set of relative file names from the base directory.
*/
private static String[] glob(File dir, String includes) throws IOException {
if(isAbsolute(includes))
throw new IOException("Expecting Ant GLOB pattern, but saw '"+includes+"'. See http://ant.apache.org/manual/Types/fileset.html for syntax");
FileSet fs = Util.createFileSet(dir,includes);
DirectoryScanner ds = fs.getDirectoryScanner(new Project());
String[] files = ds.getIncludedFiles();
return files;
}

代码示例来源:origin: org.jenkins-ci.main/jenkins-core

/**
* Runs Ant glob expansion.
*
* @return
* A set of relative file names from the base directory.
*/
@Nonnull
private static String[] glob(File dir, String includes, String excludes, boolean defaultExcludes) throws IOException {
if(isAbsolute(includes))
throw new IOException("Expecting Ant GLOB pattern, but saw '"+includes+"'. See http://ant.apache.org/manual/Types/fileset.html for syntax");
FileSet fs = Util.createFileSet(dir,includes,excludes);
fs.setDefaultexcludes(defaultExcludes);
DirectoryScanner ds = fs.getDirectoryScanner(new Project());
String[] files = ds.getIncludedFiles();
return files;
}

代码示例来源:origin: org.jvnet.hudson.main/hudson-core

/**
* Construct a path starting with a base location.
* @param base starting point for resolution, and defines channel
* @param rel a path which if relative will be resolved against base
*/
public FilePath(FilePath base, String rel) {
this.channel = base.channel;
if(isAbsolute(rel)) {
// absolute
this.remote = normalize(rel);
} else
if(base.isUnix()) {
this.remote = normalize(base.remote+'/'+rel);
} else {
//Normalize rel path for windows environment. See http://issues.hudson-ci.org/browse/HUDSON-5084
this.remote = normalize(base.remote+'\\'+ StringUtils.replace(rel, "/", "\\"));
}
}

代码示例来源:origin: org.eclipse.hudson/hudson-core

/**
* Construct a path starting with a base location.
*
* @param base starting point for resolution, and defines channel
* @param rel a path which if relative will be resolved against base
*/
public FilePath(FilePath base, String rel) {
this.channel = base.channel;
if (isAbsolute(rel)) {
// absolute
this.remote = normalize(rel);
} else if (base.isUnix()) {
this.remote = normalize(base.remote + '/' + rel);
} else {
//Normalize rel path for windows environment. See http://issues.hudson-ci.org/browse/HUDSON-5084
this.remote = normalize(base.remote + '\\' + StringUtils.replace(rel, "/", "\\"));
}
}

代码示例来源:origin: org.eclipse.hudson.main/hudson-core

/**
* Construct a path starting with a base location.
* @param base starting point for resolution, and defines channel
* @param rel a path which if relative will be resolved against base
*/
public FilePath(FilePath base, String rel) {
this.channel = base.channel;
if(isAbsolute(rel)) {
// absolute
this.remote = normalize(rel);
} else
if(base.isUnix()) {
this.remote = normalize(base.remote+'/'+rel);
} else {
//Normalize rel path for windows environment. See http://issues.hudson-ci.org/browse/HUDSON-5084
this.remote = normalize(base.remote+'\\'+ StringUtils.replace(rel, "/", "\\"));
}
}

代码示例来源:origin: hudson/hudson-2.x

/**
* Construct a path starting with a base location.
* @param base starting point for resolution, and defines channel
* @param rel a path which if relative will be resolved against base
*/
public FilePath(FilePath base, String rel) {
this.channel = base.channel;
if(isAbsolute(rel)) {
// absolute
this.remote = normalize(rel);
} else
if(base.isUnix()) {
this.remote = normalize(base.remote+'/'+rel);
} else {
//Normalize rel path for windows environment. See http://issues.hudson-ci.org/browse/HUDSON-5084
this.remote = normalize(base.remote+'\\'+ StringUtils.replace(rel, "/", "\\"));
}
}

推荐阅读
author-avatar
别紧张-我又不是什么好人还_876
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有