From dcf34b01e199ebf536ea135f52b65b2b19c3ee3c Mon Sep 17 00:00:00 2001
From: Lars Bilke <lars.bilke@ufz.de>
Date: Tue, 25 Aug 2020 14:34:24 +0200
Subject: [PATCH] [insitu] Fix cwd in Adaptor.

---
 .dockerignore                           |  1 +
 Applications/InSituLib/Adaptor.cpp      | 28 +++++++++++++++----------
 scripts/cmake/conan/config/settings.yml |  2 +-
 3 files changed, 19 insertions(+), 12 deletions(-)

diff --git a/.dockerignore b/.dockerignore
index 472cdd2e7ac..bc6c2b61bc7 100644
--- a/.dockerignore
+++ b/.dockerignore
@@ -1,2 +1,3 @@
 # .git
 Tests/Data
+_out/images
diff --git a/Applications/InSituLib/Adaptor.cpp b/Applications/InSituLib/Adaptor.cpp
index 65cbf64d90b..4a8af88eb2f 100644
--- a/Applications/InSituLib/Adaptor.cpp
+++ b/Applications/InSituLib/Adaptor.cpp
@@ -18,8 +18,7 @@
 
 #include "MeshLib/Mesh.h"
 #include "MeshLib/Vtk/VtkMappedMeshSource.h"
-
-#include <filesystem>
+#include "filesystem.h"
 
 namespace InSituLib
 {
@@ -41,12 +40,19 @@ void Initialize(BaseLib::ConfigTree const& scripts_config,
     for (auto script_config : scripts_config.getConfigSubtreeList("script"))
     {
         //! \ogs_file_param{prj__insitu__scripts__script__name}
-        auto scriptName = script_config.getConfigParameter<std::string>("name");
-        INFO("Initializing in-situ script: {:s}", scriptName);
-        std::stringstream ss;
-        ss << path << scriptName;
+        auto scriptPath =
+            fs::path(script_config.getConfigParameter<std::string>("name"));
+        if (scriptPath.is_relative())
+        {
+            scriptPath = fs::path(path) / scriptPath;
+        }
+        if (!fs::exists(scriptPath))
+        {
+            ERR("In-situ script {:s} does not exist!", scriptPath.string());
+        }
+        INFO("Initializing in-situ script: {:s}", scriptPath.string());
         vtkNew<vtkCPPythonScriptPipeline> pipeline;
-        pipeline->Initialize(ss.str().c_str());
+        pipeline->Initialize(scriptPath.c_str());
         Processor->AddPipeline(pipeline.GetPointer());
     }
 }
@@ -83,11 +89,11 @@ void CoProcess(MeshLib::Mesh const& mesh, double const time,
         vtkSource->Update();
         dataDescription->GetInputDescriptionByName("input")->SetGrid(
             vtkSource->GetOutput());
-        auto cwd = std::filesystem::current_path();
-        std::filesystem::current_path(output_directory);
+        auto cwd = fs::current_path();
+        fs::current_path(output_directory);
         Processor->CoProcess(dataDescription.GetPointer());
-        std::filesystem::current_path(cwd);
+        fs::current_path(cwd);
         INFO("End InSitu process.");
     }
 }
-}  // namespace
+}  // namespace InSituLib
diff --git a/scripts/cmake/conan/config/settings.yml b/scripts/cmake/conan/config/settings.yml
index 8b12a7315cc..a887ee4c30e 100644
--- a/scripts/cmake/conan/config/settings.yml
+++ b/scripts/cmake/conan/config/settings.yml
@@ -72,7 +72,7 @@ compiler:
         libcxx: [libstdc++, libstdc++11, libc++, c++_shared, c++_static]
         cppstd: [None, 98, gnu98, 11, gnu11, 14, gnu14, 17, gnu17, 20, gnu20]
     apple-clang:
-        version: ["5.0", "5.1", "6.0", "6.1", "7.0", "7.3", "8.0", "8.1", "9.0", "9.1", "10.0", "11.0"]
+        version: ["5.0", "5.1", "6.0", "6.1", "7.0", "7.3", "8.0", "8.1", "9.0", "9.1", "10.0", "11.0", "12.0"]
         libcxx: [libstdc++, libc++]
         cppstd: [None, 98, gnu98, 11, gnu11, 14, gnu14, 17, gnu17, 20, gnu20]
     intel:
-- 
GitLab