MCPcopy Create free account
hub / github.com/Kitware/VTK / vtkPythonGetFilePath

Function vtkPythonGetFilePath

Wrapping/PythonCore/vtkPythonArgs.cxx:417–440  ·  view source on GitHub ↗

------------------------------------------------------------------------------ Methods for getting file system paths

Source from the content-addressed store, hash-verified

415//------------------------------------------------------------------------------
416// Methods for getting file system paths
417inline bool vtkPythonGetFilePath(PyObject* o, const char*& a)
418{
419 const char* exctext = "string, None, or pathlike object required";
420 a = nullptr;
421
422 if (o == Py_None)
423 {
424 // accept Py_None as equivalent to nullptr
425 return true;
426 }
427
428#if PY_VERSION_HEX >= 0x03060000
429 bool rval = false;
430 PyObject* s = PyOS_FSPath(o);
431 if (s != nullptr)
432 {
433 rval = vtkPythonGetStringValue(s, a, exctext);
434 Py_DECREF(s);
435 }
436 return rval;
437#else
438 return vtkPythonGetStringValue(o, a, exctext);
439#endif
440}
441
442inline bool vtkPythonGetFilePath(PyObject* o, std::string& a)
443{

Callers

nothing calls this directly

Calls 2

vtkPythonGetStringValueFunction · 0.85

Tested by

no test coverage detected