mirror of
https://github.com/jenkinsci/jenkins.git
synced 2026-10-31 13:35:19 +00:00
create a directory first, if needed.
git-svn-id: https://hudson.dev.java.net/svn/hudson/trunk/hudson/main@1701 71c3de6d-444a-0410-be80-ed276b4c234a
This commit is contained in:
1 parent
7e91be5aaf
commit
833cb3270b
1 file changed
+4
-1
@@ -436,6 +436,7 @@ public final class FilePath implements Serializable {
|
||||
/**
|
||||
* Writes to this file.
|
||||
* If this file already exists, it will be overwritten.
|
||||
* If the directory doesn't exist, it will be created.
|
||||
*/
|
||||
public OutputStream write() throws IOException {
|
||||
if(channel==null)
|
||||
@@ -444,7 +445,9 @@ public final class FilePath implements Serializable {
|
||||
final Pipe p = Pipe.createLocalToRemote();
|
||||
channel.callAsync(new Callable<Void,IOException>() {
|
||||
public Void call() throws IOException {
|
||||
FileOutputStream fos = new FileOutputStream(new File(remote));
|
||||
File f = new File(remote);
|
||||
f.getParentFile().mkdirs();
|
||||
FileOutputStream fos = new FileOutputStream(f);
|
||||
Util.copyStream(p.getIn(),fos);
|
||||
fos.close();
|
||||
p.getIn().close();
|
||||
|
||||
Reference in new issue
Block a user