提交 d3a13f46 编写于 作者: K Kohsuke Kawaguchi

making the method more discoverable by having an instance method

上级 f7900f27
......@@ -53,6 +53,7 @@ import static hudson.FilePath.TarCompression.GZIP;
import hudson.org.apache.tools.tar.TarInputStream;
import hudson.util.io.Archiver;
import hudson.util.io.ArchiverFactory;
import jenkins.util.VirtualFile;
import org.apache.tools.ant.DirectoryScanner;
import org.apache.tools.ant.Project;
import org.apache.tools.ant.types.FileSet;
......@@ -1041,6 +1042,13 @@ public final class FilePath implements Serializable {
});
}
/**
* Gets the {@link VirtualFile} representation of this {@link FilePath}
*/
public VirtualFile toVirtualFile() {
return VirtualFile.forFilePath(this);
}
/**
* Creates this directory.
*/
......
......@@ -93,7 +93,7 @@ public final class DirectoryBrowserSupport implements HttpResponse {
* False to serve "index.html"
*/
public DirectoryBrowserSupport(ModelObject owner, FilePath base, String title, String icon, boolean serveDirIndex) {
this(owner, VirtualFile.forFilePath(base), title, icon, serveDirIndex);
this(owner, base.toVirtualFile(), title, icon, serveDirIndex);
}
/**
......@@ -148,7 +148,7 @@ public final class DirectoryBrowserSupport implements HttpResponse {
* from the {@code doXYZ} method and let Stapler generate a response for you.
*/
public void serveFile(StaplerRequest req, StaplerResponse rsp, FilePath root, String icon, boolean serveDirIndex) throws IOException, ServletException, InterruptedException {
serveFile(req, rsp, VirtualFile.forFilePath(root), icon, serveDirIndex);
serveFile(req, rsp, root.toVirtualFile(), icon, serveDirIndex);
}
private void serveFile(StaplerRequest req, StaplerResponse rsp, VirtualFile root, String icon, boolean serveDirIndex) throws IOException, ServletException, InterruptedException {
......
......@@ -247,7 +247,7 @@ public abstract class VirtualFile implements Comparable<VirtualFile> {
}
}
@Override public VirtualFile getParent() {
return forFilePath(f.getParent());
return f.getParent().toVirtualFile();
}
@Override public boolean isDirectory() throws IOException {
try {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册