com.thoughtworks.go.util.FileUtil.applyBaseDirIfRelativeAndNormalize()方法的使用及代码示例

x33g5p2x  于2022-01-19 转载在 其他  
字(2.5k)|赞(0)|评价(0)|浏览(124)

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

FileUtil.applyBaseDirIfRelativeAndNormalize介绍

暂无

代码示例

代码示例来源:origin: gocd/gocd

public static String join(File defaultWorkingDir, String actualFileToUse) {
  if (actualFileToUse == null) {
    LOGGER.trace("Using the default Directory->{}", defaultWorkingDir);
    return FilenameUtils.separatorsToUnix(defaultWorkingDir.getPath());
  }
  return applyBaseDirIfRelativeAndNormalize(defaultWorkingDir, new File(actualFileToUse));
}

代码示例来源:origin: gocd/gocd

protected File getSource(File rootPath) {
  return new File(FileUtil.applyBaseDirIfRelativeAndNormalize(rootPath, new File(getSrc())));
}

代码示例来源:origin: gocd/gocd

private ArrayList<File> findMatchedSourceFiles(BuildSession buildSession, File workingDirectory, String[] sources) {
    ArrayList<File> allFiles = new ArrayList<>();
    for (String src : sources) {
      File source = new File(FileUtil.applyBaseDirIfRelativeAndNormalize(workingDirectory, new File(src)));

      WildcardScanner wildcardScanner = new WildcardScanner(workingDirectory, src);
      File[] files = wildcardScanner.getFiles();

      if (files.length > 0) {
        final List<File> fileList = files == null ? new ArrayList<>() : Arrays.asList(files);
        allFiles.addAll(fileList);
      } else {
        final String message = MessageFormat.format("The Directory {0} specified as a test artifact was not found."
            + " Please check your configuration", FilenameUtils.separatorsToUnix(source.getPath()));
        buildSession.printlnWithPrefix(message);
        LOG.error(message);
      }
    }
    return allFiles;
  }
}

代码示例来源:origin: gocd/gocd

@Override
  public Builder createBuilder(BuilderFactory builderFactory, ExecTask task, Pipeline pipeline, UpstreamPipelineResolver pipelineResolver) {
    String workingDir = task.workingDirectory();
    String command = task.command();

    File newWorkingDir = workingDir == null ? pipeline.defaultWorkingFolder() : new File(
        applyBaseDirIfRelativeAndNormalize(pipeline.defaultWorkingFolder(), new File(workingDir)));
    Builder builder = builderFactory.builderFor(task.cancelTask(), pipeline, pipelineResolver);
    String description = task.describe();

    if (!task.getArgList().isEmpty()) {
      return new CommandBuilderWithArgList(command, task.getArgList().toStringArray(), newWorkingDir, task.getConditions(), builder, description);
    } else {
      return new CommandBuilder(command, task.getArgs(), newWorkingDir, task.getConditions(), builder, description);
    }

  }
}

相关文章