From 9dfd5b82001494026932b397964c69cfb1948e35 Mon Sep 17 00:00:00 2001 From: kohsuke Date: Mon, 15 Jan 2007 23:48:38 +0000 Subject: [PATCH] bug fix. Local write() should create parent directories just like remote write(). git-svn-id: https://hudson.dev.java.net/svn/hudson/trunk/hudson/main@1773 71c3de6d-444a-0410-be80-ed276b4c234a --- core/src/main/java/hudson/FilePath.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/core/src/main/java/hudson/FilePath.java b/core/src/main/java/hudson/FilePath.java index 326c409739..ffb5d2d647 100644 --- a/core/src/main/java/hudson/FilePath.java +++ b/core/src/main/java/hudson/FilePath.java @@ -439,8 +439,11 @@ public final class FilePath implements Serializable { * If the directory doesn't exist, it will be created. */ public OutputStream write() throws IOException, InterruptedException { - if(channel==null) - return new FileOutputStream(new File(remote)); + if(channel==null) { + File f = new File(remote); + f.getParentFile().mkdirs(); + return new FileOutputStream(f); + } return channel.call(new Callable() { public OutputStream call() throws IOException {