[Part]handle unicode filename on win

This commit is contained in:
wandererfan
2023-03-29 07:53:54 -07:00
committed by WandererFan
parent 9666aac669
commit 7fa7cb7f0b

View File

@@ -60,6 +60,7 @@
#endif // _PreComp
#include <Base/Console.h>
#include <Base/FileInfo.h>
#include "TopoShapeWirePy.h"
@@ -126,8 +127,14 @@ PyObject* FT2FC(const Py_UNICODE *PyUString,
throw std::runtime_error(ErrorMsg.str());
}
std::ifstream fontfile;
fontfile.open(FontSpec, std::ios::binary|std::ios::in);
#ifdef FC_OS_WIN32
Base::FileInfo winFI(FontSpec);
fontfile.open(winFI.toStdWString().c_str(), std::ios::binary | std::ios::in);
#else
fontfile.open(FontSpec, std::ios::binary | std::ios::in);
#endif
if (!fontfile.is_open()) {
//get indignant
ErrorMsg << "Can not open font file: " << FontSpec;