Mesh: Workaround to load 3mf files not supported by zipios library
This commit is contained in:
@@ -393,3 +393,17 @@ std::vector<std::string> Base::Tools::splitSubName(const std::string& subname)
|
||||
|
||||
return subNames;
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
|
||||
void Base::ZipTools::rewrite(const std::string& source, const std::string& target)
|
||||
{
|
||||
Base::PyGILStateLocker lock;
|
||||
PyObject* module = PyImport_ImportModule("freecad.utils_zip");
|
||||
if (!module) {
|
||||
throw Py::Exception();
|
||||
}
|
||||
|
||||
Py::Module commands(module, true);
|
||||
commands.callMemberFunction("rewrite", Py::TupleN(Py::String(source), Py::String(target)));
|
||||
}
|
||||
|
||||
@@ -329,6 +329,14 @@ struct BaseExport Tools
|
||||
static std::vector<std::string> splitSubName(const std::string& subname);
|
||||
};
|
||||
|
||||
struct BaseExport ZipTools
|
||||
{
|
||||
/**
|
||||
* @brief rewrite Rewrite a zip file under a new name.
|
||||
*/
|
||||
static void rewrite(const std::string& source, const std::string& target);
|
||||
};
|
||||
|
||||
|
||||
} // namespace Base
|
||||
|
||||
|
||||
Reference in New Issue
Block a user