From 2b320a5488efda1c31f2b0b097a1efd3da20eebf Mon Sep 17 00:00:00 2001
From: mattijs <mattijs>
Date: Thu, 5 Jan 2012 10:07:04 +0000
Subject: [PATCH] BUG: surfaceCheck: handle .gz additional extension (e.g.
 motorBike.obj.gz)

---
 .../surface/surfaceCheck/surfaceCheck.C          | 16 +++++++++-------
 1 file changed, 9 insertions(+), 7 deletions(-)

diff --git a/applications/utilities/surface/surfaceCheck/surfaceCheck.C b/applications/utilities/surface/surfaceCheck/surfaceCheck.C
index 87d9fa461b0..09a030d77b2 100644
--- a/applications/utilities/surface/surfaceCheck/surfaceCheck.C
+++ b/applications/utilities/surface/surfaceCheck/surfaceCheck.C
@@ -569,6 +569,14 @@ int main(int argc, char *argv[])
         Info<< "Splitting surface into parts ..." << endl << endl;
 
         fileName surfFileNameBase(surfFileName.name());
+        const word fileType = surfFileNameBase.ext();
+        // Strip extension
+        surfFileNameBase = surfFileNameBase.lessExt();
+        // If extension was .gz strip original extension
+        if (fileType == "gz")
+        {
+            surfFileNameBase = surfFileNameBase.lessExt();
+        }
 
         for (label zone = 0; zone < numZones; zone++)
         {
@@ -595,13 +603,7 @@ int main(int argc, char *argv[])
                 )
             );
 
-            fileName subFileName
-            (
-                surfFileNameBase.lessExt()
-              + "_"
-              + name(zone)
-              + ".obj"
-            );
+            fileName subFileName(surfFileNameBase + "_" + name(zone) + ".obj");
 
             Info<< "writing part " << zone << " size " << subSurf.size()
                 << " to " << subFileName << endl;
-- 
GitLab