issue #1027 use unicode filepaths

This commit is contained in:
Sebastian Hoogen
2014-09-21 23:45:32 +02:00
committed by wmayer
parent 7db2cdc008
commit 01cf0f5872
28 changed files with 396 additions and 243 deletions

View File

@@ -52,13 +52,15 @@ using namespace Points;
static PyObject *
open(PyObject *self, PyObject *args)
{
const char* Name;
if (!PyArg_ParseTuple(args, "s",&Name))
char* Name;
if (!PyArg_ParseTuple(args, "et","utf-8",&Name))
return NULL;
std::string EncodedName = std::string(Name);
PyMem_Free(Name);
PY_TRY {
Base::Console().Log("Open in Points with %s",Name);
Base::FileInfo file(Name);
Base::Console().Log("Open in Points with %s",EncodedName.c_str());
Base::FileInfo file(EncodedName.c_str());
// extract ending
if (file.extension() == "")
@@ -69,7 +71,7 @@ open(PyObject *self, PyObject *args)
App::Document *pcDoc = App::GetApplication().newDocument("Unnamed");
Points::Feature *pcFeature = (Points::Feature *)pcDoc->addObject("Points::Feature", file.fileNamePure().c_str());
Points::PointKernel pkTemp;
pkTemp.load(Name);
pkTemp.load(EncodedName.c_str());
pcFeature->Points.setValue( pkTemp );
}
@@ -82,7 +84,7 @@ open(PyObject *self, PyObject *args)
// pcl test
pcl::PointCloud<pcl::PointXYZRGB> cloud_in;
pcl::io::loadPLYFile<pcl::PointXYZRGB>(Name,cloud_in);
pcl::io::loadPLYFile<pcl::PointXYZRGB>(EncodedName.c_str(),cloud_in);
for (pcl::PointCloud<pcl::PointXYZRGB>::const_iterator it = cloud_in.begin();it!=cloud_in.end();++it)
pkTemp.push_back(Base::Vector3d(it->x,it->y,it->z));
@@ -100,14 +102,16 @@ open(PyObject *self, PyObject *args)
static PyObject *
insert(PyObject *self, PyObject *args)
{
const char* Name;
char* Name;
const char* DocName;
if (!PyArg_ParseTuple(args, "ss",&Name,&DocName))
if (!PyArg_ParseTuple(args, "ets","utf-8",&Name,&DocName))
return NULL;
std::string EncodedName = std::string(Name);
PyMem_Free(Name);
PY_TRY {
Base::Console().Log("Import in Points with %s",Name);
Base::FileInfo file(Name);
Base::Console().Log("Import in Points with %s",EncodedName.c_str());
Base::FileInfo file(EncodedName.c_str());
// extract ending
if (file.extension() == "")
@@ -122,7 +126,7 @@ insert(PyObject *self, PyObject *args)
Points::Feature *pcFeature = (Points::Feature *)pcDoc->addObject("Points::Feature", file.fileNamePure().c_str());
Points::PointKernel pkTemp;
pkTemp.load(Name);
pkTemp.load(EncodedName.c_str());
pcFeature->Points.setValue( pkTemp );
}
#ifdef HAVE_PCL_IO
@@ -137,7 +141,7 @@ insert(PyObject *self, PyObject *args)
// pcl test
pcl::PointCloud<pcl::PointXYZRGB> cloud_in;
pcl::io::loadPLYFile<pcl::PointXYZRGB>(Name,cloud_in);
pcl::io::loadPLYFile<pcl::PointXYZRGB>(EncodedName.c_str(),cloud_in);
for (pcl::PointCloud<pcl::PointXYZRGB>::const_iterator it = cloud_in.begin();it!=cloud_in.end();++it)
pkTemp.push_back(Base::Vector3d(it->x,it->y,it->z));