Skip to content
Snippets Groups Projects
Commit 33f4fc56 authored by Michael Kuron's avatar Michael Kuron :mortar_board:
Browse files

Correctly use filesystem::absolute/canonical on recent C++ standard libraries

The two-argument version was removed late in the standardization process
parent be036c15
No related merge requests found
...@@ -77,17 +77,21 @@ namespace python_coupling { ...@@ -77,17 +77,21 @@ namespace python_coupling {
std::string cwd(cwd_buf); std::string cwd(cwd_buf);
std::free(cwd_buf); std::free(cwd_buf);
path = filesystem::absolute( path, cwd );
#else #else
filesystem::path cwd = filesystem::current_path(); path = filesystem::absolute( path );
#endif #endif
path = filesystem::absolute( path, cwd );
if ( path.extension() == ".py" ) if ( path.extension() == ".py" )
{ {
moduleName = path.stem().string(); moduleName = path.stem().string();
if ( ! path.parent_path().empty() ) { if ( ! path.parent_path().empty() ) {
#ifdef CURRENT_PATH_WORKAROUND
std::string p = filesystem::canonical(path.parent_path(), cwd).string(); 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"; code << "sys.path.append( r'" << p << "')" << "\n";
} }
} }
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment