Add forward class definition for std::filesystem::path class

The namespace is missing for the path class, so this provides
more type information to fix this problem.

Closes #2993
This commit is contained in:
William S Fulton 2024-08-19 18:31:09 +01:00
parent cb0d31f6c9
commit 5ac5d90f97
3 changed files with 11 additions and 1 deletions

View File

@ -7,6 +7,9 @@ the issue number to the end of the URL: https://github.com/swig/swig/issues/
Version 4.3.0 (in progress)
===========================
2024-08-19: wsfulton
[Python] #2993 Add missing std::filesystem namespace to std_filesystem.i.
2024-08-17: olly
#904 #1907 #2579 Fix string literal and character literal wrapping bugs.

View File

@ -58,7 +58,8 @@ std::string pathPtrToStr(const std::filesystem::path * p) {
return p->string();
}
std::filesystem::path roundTrip(const std::filesystem::path& p) {
namespace stdfs = std::filesystem;
std::filesystem::path roundTrip(const stdfs::path& p) {
return p;
}
%}

View File

@ -8,6 +8,12 @@
#include <filesystem>
%}
namespace std {
namespace filesystem {
class path;
}
}
%fragment("SWIG_std_filesystem", "header") {
SWIGINTERN PyObject *SWIG_std_filesystem_importPathClass() {
PyObject *module = PyImport_ImportModule("pathlib");