From f2c6964a4869c54f2aaeacc96637761793082f6a Mon Sep 17 00:00:00 2001
From: Andrew Heather <a.heather@opencfd.co.uk>
Date: Mon, 23 Jan 2017 08:41:43 +0000
Subject: [PATCH] BUG: boundaryDataTemplates - make dir before writing to
 stream.  Fixes #390

---
 .../boundaryData/boundaryDataSurfaceWriterTemplates.C      | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/src/sampling/sampledSurface/writers/boundaryData/boundaryDataSurfaceWriterTemplates.C b/src/sampling/sampledSurface/writers/boundaryData/boundaryDataSurfaceWriterTemplates.C
index dcc9452d00b..d19c8458694 100644
--- a/src/sampling/sampledSurface/writers/boundaryData/boundaryDataSurfaceWriterTemplates.C
+++ b/src/sampling/sampledSurface/writers/boundaryData/boundaryDataSurfaceWriterTemplates.C
@@ -3,7 +3,7 @@
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
     \\  /    A nd           | Copyright (C) 2015 OpenFOAM Foundation
-     \\/     M anipulation  | Copyright (C) 2016 OpenCFD Ltd.
+     \\/     M anipulation  | Copyright (C) 2016-2017 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM.
@@ -114,8 +114,9 @@ Foam::fileName Foam::boundaryDataSurfaceWriter::writeTemplate
 
     // Write field
     {
-        fileName valsFile(baseDir/timeName/fieldName);
-        OFstream os(valsFile);
+        fileName valsDir(baseDir/timeName);
+        mkDir(valsDir);
+        OFstream os(valsDir/fieldName);
         os  << values;
     }
 
-- 
GitLab