From 63b2ab8069c3bebfb0270805d7d7d67dc17a8454 Mon Sep 17 00:00:00 2001
From: mattijs <mattijs>
Date: Wed, 8 Feb 2017 08:45:40 +0000
Subject: [PATCH] ENH: surfaceMeshTriangulate: handle absolute paths. Fixes
 #398.

---
 .../surfaceMeshTriangulate/surfaceMeshTriangulate.C  | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/applications/utilities/surface/surfaceMeshTriangulate/surfaceMeshTriangulate.C b/applications/utilities/surface/surfaceMeshTriangulate/surfaceMeshTriangulate.C
index aed226b07fb..ee4544ee345 100644
--- a/applications/utilities/surface/surfaceMeshTriangulate/surfaceMeshTriangulate.C
+++ b/applications/utilities/surface/surfaceMeshTriangulate/surfaceMeshTriangulate.C
@@ -3,7 +3,7 @@
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
     \\  /    A nd           | Copyright (C) 2011-2016 OpenFOAM Foundation
-     \\/     M anipulation  |
+     \\/     M anipulation  | Copyright (C) 2017 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM.
@@ -361,9 +361,13 @@ int main(int argc, char *argv[])
 
         fileName globalCasePath
         (
-            runTime.processorCase()
-          ? runTime.path()/".."/outFileName
-          : runTime.path()/outFileName
+            outFileName.isAbsolute()
+          ? outFileName
+          : (
+                runTime.processorCase()
+              ? runTime.rootPath()/runTime.globalCaseName()/outFileName
+              : runTime.path()/outFileName
+            )
         );
 
         Info<< "Writing merged surface to " << globalCasePath << endl;
-- 
GitLab