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

@@ -166,6 +166,7 @@
#include "ProgressIndicator.h"
#include "modelRefine.h"
#include "Tools.h"
#include "encodeFilename.h"
using namespace Part;
@@ -570,8 +571,7 @@ void TopoShape::importIges(const char *FileName)
IGESControl_Controller::Init();
Interface_Static::SetIVal("read.surfacecurve.mode",3);
IGESControl_Reader aReader;
QString fn = QString::fromUtf8(FileName);
if (aReader.ReadFile((const char*)fn.toLocal8Bit()) != IFSelect_RetDone)
if (aReader.ReadFile(encodeFilename(FileName).c_str()) != IFSelect_RetDone)
throw Base::Exception("Error in reading IGES");
Handle_Message_ProgressIndicator pi = new ProgressIndicator(100);
@@ -596,8 +596,7 @@ void TopoShape::importStep(const char *FileName)
{
try {
STEPControl_Reader aReader;
QString fn = QString::fromUtf8(FileName);
if (aReader.ReadFile((const char*)fn.toLocal8Bit()) != IFSelect_RetDone)
if (aReader.ReadFile(encodeFilename(FileName).c_str()) != IFSelect_RetDone)
throw Base::Exception("Error in reading STEP");
Handle_Message_ProgressIndicator pi = new ProgressIndicator(100);
@@ -627,8 +626,7 @@ void TopoShape::importBrep(const char *FileName)
Handle_Message_ProgressIndicator pi = new ProgressIndicator(100);
pi->NewScope(100, "Reading BREP file...");
pi->Show();
QString fn = QString::fromUtf8(FileName);
BRepTools::Read(aShape,(const char*)fn.toLocal8Bit(),aBuilder,pi);
BRepTools::Read(aShape,encodeFilename(FileName).c_str(),aBuilder,pi);
pi->EndScope();
#else
BRepTools::Read(aShape,(const Standard_CString)FileName,aBuilder);
@@ -699,8 +697,7 @@ void TopoShape::exportIges(const char *filename) const
IGESControl_Writer aWriter;
aWriter.AddShape(this->_Shape);
aWriter.ComputeModel();
QString fn = QString::fromUtf8(filename);
if (aWriter.Write((const char*)fn.toLocal8Bit()) != IFSelect_RetDone)
if (aWriter.Write(encodeFilename(filename).c_str()) != IFSelect_RetDone)
throw Base::Exception("Writing of IGES failed");
}
catch (Standard_Failure) {
@@ -724,14 +721,13 @@ void TopoShape::exportStep(const char *filename) const
throw Base::Exception("Error in transferring STEP");
APIHeaderSection_MakeHeader makeHeader(aWriter.Model());
makeHeader.SetName(new TCollection_HAsciiString((const Standard_CString)filename));
makeHeader.SetName(new TCollection_HAsciiString((const Standard_CString)(encodeFilename(filename).c_str())));
makeHeader.SetAuthorValue (1, new TCollection_HAsciiString("FreeCAD"));
makeHeader.SetOrganizationValue (1, new TCollection_HAsciiString("FreeCAD"));
makeHeader.SetOriginatingSystem(new TCollection_HAsciiString("FreeCAD"));
makeHeader.SetDescriptionValue(1, new TCollection_HAsciiString("FreeCAD Model"));
QString fn = QString::fromUtf8(filename);
if (aWriter.Write((const char*)fn.toLocal8Bit()) != IFSelect_RetDone)
if (aWriter.Write(encodeFilename(filename).c_str()) != IFSelect_RetDone)
throw Base::Exception("Writing of STEP failed");
pi->EndScope();
}
@@ -743,8 +739,7 @@ void TopoShape::exportStep(const char *filename) const
void TopoShape::exportBrep(const char *filename) const
{
QString fn = QString::fromUtf8(filename);
if (!BRepTools::Write(this->_Shape,(const char*)fn.toLocal8Bit()))
if (!BRepTools::Write(this->_Shape,encodeFilename(filename).c_str()))
throw Base::Exception("Writing of BREP failed");
}
@@ -765,8 +760,7 @@ void TopoShape::exportStl(const char *filename, double deflection) const
writer.RelativeMode() = false;
writer.SetDeflection(deflection);
}
QString fn = QString::fromUtf8(filename);
writer.Write(this->_Shape,(const Standard_CString)fn.toLocal8Bit());
writer.Write(this->_Shape,encodeFilename(filename).c_str());
}
void TopoShape::exportFaceSet(double dev, double ca, std::ostream& str) const