diff --git a/core/src/main/java/hudson/FilePath.java b/core/src/main/java/hudson/FilePath.java index 2958c08bd6..2bb8065469 100644 --- a/core/src/main/java/hudson/FilePath.java +++ b/core/src/main/java/hudson/FilePath.java @@ -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() { + public FilePath call() throws IOException { + return new FilePath(new File(System.getProperty("user.home"))); + } + }); + } }