Skip to content

Commit

Permalink
[Part]handle unicode filename on win
Browse files Browse the repository at this point in the history
  • Loading branch information
WandererFan committed Mar 29, 2023
1 parent 9666aac commit 7fa7cb7
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/Mod/Part/App/FT2FC.cpp
Expand Up @@ -60,6 +60,7 @@
#endif // _PreComp

#include <Base/Console.h>
#include <Base/FileInfo.h>

#include "TopoShapeWirePy.h"

Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 7fa7cb7

Please sign in to comment.