From 33f4fc56e9226678a1bf39c134c55cb141f57dd8 Mon Sep 17 00:00:00 2001
From: Michael Kuron <mkuron@icp.uni-stuttgart.de>
Date: Thu, 23 Jul 2020 14:37:21 +0200
Subject: [PATCH] Correctly use filesystem::absolute/canonical on recent C++
 standard libraries

The two-argument version was removed late in the standardization process
---
 src/python_coupling/PythonCallback.cpp | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/src/python_coupling/PythonCallback.cpp b/src/python_coupling/PythonCallback.cpp
index c469b10df..507087fc9 100644
--- a/src/python_coupling/PythonCallback.cpp
+++ b/src/python_coupling/PythonCallback.cpp
@@ -77,17 +77,21 @@ namespace python_coupling {
 
       std::string cwd(cwd_buf);
       std::free(cwd_buf);
+      path = filesystem::absolute( path, cwd );
 #else
-      filesystem::path cwd = filesystem::current_path();
+      path = filesystem::absolute( path );
 #endif
-      path = filesystem::absolute( path, cwd );
       if ( path.extension() == ".py" )
       {
          moduleName = path.stem().string();
 
 
          if ( ! path.parent_path().empty() )  {
+#ifdef CURRENT_PATH_WORKAROUND
             std::string p = filesystem::canonical(path.parent_path(), cwd).string();
+#else
+            std::string p = filesystem::canonical(path.parent_path()).string();
+#endif
             code << "sys.path.append( r'" << p << "')" << "\n";
          }
       }
-- 
GitLab