本文整理了Java中com.thoughtworks.go.util.FileUtil.applyBaseDirIfRelative()
方法的一些代码示例,展示了FileUtil.applyBaseDirIfRelative()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。FileUtil.applyBaseDirIfRelative()
方法的具体详情如下:
包路径:com.thoughtworks.go.util.FileUtil
类名称:FileUtil
方法名:applyBaseDirIfRelative
暂无
代码示例来源:origin: gocd/gocd
File resolveRelativeDir(String... dirs) {
if (dirs.length == 0) {
return workingDir;
}
File result = new File(dirs[dirs.length - 1]);
for (int i = dirs.length - 2; i >= 0; i--) {
result = applyBaseDirIfRelative(new File(dirs[i]), result);
}
return applyBaseDirIfRelative(workingDir, result);
}
代码示例来源:origin: gocd/gocd
public static String applyBaseDirIfRelativeAndNormalize(File baseDir, File actualFileToUse) {
return FilenameUtils.separatorsToUnix(applyBaseDirIfRelative(baseDir, actualFileToUse).getPath());
}
代码示例来源:origin: gocd/gocd
@Test
public void shouldAppendToDefaultIfRelative() throws Exception {
final File relativepath = new File("zx");
assertThat(FileUtil.applyBaseDirIfRelative(new File("xyz"), relativepath),
is(new File("xyz", relativepath.getPath())));
}
代码示例来源:origin: gocd/gocd
@Test
public void shouldUseSpeficiedFolderIfAbsolute() throws Exception {
final File absolutePath = new File("zx").getAbsoluteFile();
assertThat(FileUtil.applyBaseDirIfRelative(new File("xyz"), absolutePath), is(absolutePath));
}
代码示例来源:origin: gocd/gocd
@Test
public void shouldUseSpeficiedFolderIfBaseDirIsEmpty() throws Exception {
assertThat(FileUtil.applyBaseDirIfRelative(new File(""), new File("zx")), is(new File("zx")));
}
代码示例来源:origin: gocd/gocd
@Test
public void shouldUseDefaultIfActualisNull() throws Exception {
final File baseFile = new File("xyz");
assertThat(FileUtil.applyBaseDirIfRelative(baseFile, null), is(baseFile));
}
内容来源于网络,如有侵权,请联系作者删除!