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

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

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

FilePath.toVirtualFile介绍

[英]Gets the VirtualFile representation of this FilePath
[中]获取此文件路径的虚拟文件表示形式

代码示例

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

/**
 * @param owner
 *      The parent model object under which the directory browsing is added.
 * @param base
 *      The root of the directory that's bound to URL.
 * @param title
 *      Used in the HTML caption. 
 * @param icon
 *      The icon file name, like "folder.gif"
 * @param serveDirIndex
 *      True to generate the directory index.
 *      False to serve "index.html"
 */
public DirectoryBrowserSupport(ModelObject owner, FilePath base, String title, String icon, boolean serveDirIndex) {
  this(owner, base.toVirtualFile(), title, icon, serveDirIndex);
}

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

@Override public VirtualFile getParent() {
  return f.getParent().toVirtualFile();
}
@Override public boolean isDirectory() throws IOException {

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

/**
 * Serves a file from the file system (Maps the URL to a directory in a file system.)
 *
 * @param icon
 *      The icon file name, like "folder-open.gif"
 * @param serveDirIndex
 *      True to generate the directory index.
 *      False to serve "index.html"
 * @deprecated as of 1.297
 *      Instead of calling this method explicitly, just return the {@link DirectoryBrowserSupport} object
 *      from the {@code doXYZ} method and let Stapler generate a response for you.
 */
@Deprecated
public void serveFile(StaplerRequest req, StaplerResponse rsp, FilePath root, String icon, boolean serveDirIndex) throws IOException, ServletException, InterruptedException {
  serveFile(req, rsp, root.toVirtualFile(), icon, serveDirIndex);
}

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

/**
 * @param owner
 *      The parent model object under which the directory browsing is added.
 * @param base
 *      The root of the directory that's bound to URL.
 * @param title
 *      Used in the HTML caption. 
 * @param icon
 *      The icon file name, like "folder.gif"
 * @param serveDirIndex
 *      True to generate the directory index.
 *      False to serve "index.html"
 */
public DirectoryBrowserSupport(ModelObject owner, FilePath base, String title, String icon, boolean serveDirIndex) {
  this(owner, base.toVirtualFile(), title, icon, serveDirIndex);
}

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

@Override public VirtualFile getParent() {
  return f.getParent().toVirtualFile();
}
@Override public boolean isDirectory() throws IOException {

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

/**
 * Serves a file from the file system (Maps the URL to a directory in a file system.)
 *
 * @param icon
 *      The icon file name, like "folder-open.gif"
 * @param serveDirIndex
 *      True to generate the directory index.
 *      False to serve "index.html"
 * @deprecated as of 1.297
 *      Instead of calling this method explicitly, just return the {@link DirectoryBrowserSupport} object
 *      from the {@code doXYZ} method and let Stapler generate a response for you.
 */
@Deprecated
public void serveFile(StaplerRequest req, StaplerResponse rsp, FilePath root, String icon, boolean serveDirIndex) throws IOException, ServletException, InterruptedException {
  serveFile(req, rsp, root.toVirtualFile(), icon, serveDirIndex);
}

代码示例来源:origin: jenkinsci/copyartifact-plugin

@Override protected VirtualFile getArtifacts(Run<?,?> src, PrintStream console) throws IOException, InterruptedException {
  if (src instanceof AbstractBuild) {
    FilePath srcDir = ((AbstractBuild) src).getWorkspace();
    if (srcDir != null && srcDir.exists()) {
      return srcDir.toVirtualFile();
    } else {
      console.println(Messages.CopyArtifact_MissingSrcWorkspace()); // (see JENKINS-3330)
      return null;
    }
  } else {
    return super.getArtifacts(src, console);
  }
}

代码示例来源:origin: jenkinsci/copyartifact-plugin

/**
 * Load artifacts from a given build.
 * @param sourceBuild a build which may have associated artifacts
 * @param console a way to print messages
 * @return a {@linkplain VirtualFile#isDirectory directory} of artifacts, or null if missing
 */
protected @CheckForNull VirtualFile getArtifacts(Run<?, ?> sourceBuild, PrintStream console) throws IOException, InterruptedException {
  if (Util.isOverridden(BuildSelector.class, getClass(), "getSourceDirectory", Run.class, PrintStream.class)) {
    FilePath old = getSourceDirectory(sourceBuild, console);
    return old != null ? old.toVirtualFile() : null;
  } else {
    VirtualFile root = sourceBuild.getArtifactManager().root();
    return root.isDirectory() ? root : null;
  }
}

相关文章