Skip to content

Commit

Permalink
temp
Browse files Browse the repository at this point in the history
  • Loading branch information
ianrrees committed Mar 19, 2017
1 parent ac24809 commit d537f6e
Showing 1 changed file with 22 additions and 5 deletions.
27 changes: 22 additions & 5 deletions src/App/Application.cpp
Expand Up @@ -2293,14 +2293,31 @@ std::string Application::FindHomePath(const char* call)
for (auto i( PyList_Size(pySysPath)-1 ); i >= 0 ; --i) {
auto pyPath( PyList_GetItem(pySysPath, i) );

std::string path;
#if PY_MAJOR_VERSION >= 3
if ( !PyUnicode_Check(pyPath) )
if ( PyUnicode_Check(pyPath) ) {
// Python 3 string
path =PyUnicode_AsUTF8(pyPath);

} else {
continue;
std::string path( PyUnicode_AsUTF8(pyPath) );
#else
if ( !PyString_Check(pyPath) )
}

#else
if ( PyString_Check(pyPath) ) {
// Python 2 string type
path = PyString_AsString(pyPath);

} else if ( PyUnicode_Check(pyPath) ) {
// Python 2 unicode type
auto fromUnicode( PyUnicode_AsUTF8String(pyPath) );
path = PyString_AsString(fromUnicode);
Py_XDECREF(fromUnicode);

} else {
continue;
std::string path( PyString_AsString(pyPath) );
}

#endif // #if/else PY_MAJOR_VERSION >= 3

// Try to find FreeCAD.so within this path
Expand Down

0 comments on commit d537f6e

Please sign in to comment.