added a convenience method

This commit is contained in:
Kohsuke Kawaguchi committed 2013-07-26 21:02:13 -07:00
1 parent cae8c5f2ef
commit c462cb634c
1 file changed
+12
+12
View File
@@ -2450,4 +2450,16 @@ public final class FilePath implements Serializable {
throw new AssertionError(e);
}
}
/**
* Gets the {@link FilePath} representation of the "~" directory
* (User's home directory in the Unix sense) of the given channel.
*/
public static FilePath getHomeDirectory(VirtualChannel ch) throws InterruptedException, IOException {
ch.call(new Callable<FilePath,IOException>() {
public FilePath call() throws IOException {
return new FilePath(new File(System.getProperty("user.home")));
}
});
}
}