workaround for bug in VS 2013 that occurs at Python init time

This commit is contained in:
wmayer
2018-04-15 19:05:06 +02:00
parent 4adeb7702d
commit 7ed84a6590
3 changed files with 38 additions and 1 deletions

View File

@@ -71,6 +71,29 @@ const char sBanner[] = "\xc2\xa9 Juergen Riegel, Werner Mayer, Yorik van Havre 2
void InitMiniDumpWriter(const std::string&);
#endif
class Redirection
{
public:
Redirection(FILE* f)
: fi(Base::FileInfo::getTempFileName()), file(f)
{
#ifdef WIN32
_wfreopen(fi.toStdWString().c_str(),L"w",file);
#else
freopen(fi.filePath().c_str(),"w",file);
#endif
}
~Redirection()
{
fclose(file);
fi.deleteFile();
}
private:
Base::FileInfo fi;
FILE* file;
};
#if defined (FC_OS_LINUX) || defined(FC_OS_BSD)
QString myDecoderFunc(const QByteArray &localFileName)
{
@@ -133,6 +156,13 @@ int main( int argc, char ** argv )
}
#endif
#if PY_MAJOR_VERSION >= 3
#if defined(_MSC_VER) && _MSC_VER <= 1800
// See InterpreterSingleton::init
Redirection out(stdout), err(stderr), inp(stdin);
#endif
#endif // PY_MAJOR_VERSION
// Name and Version of the Application
App::Application::Config()["ExeName"] = "FreeCAD";
App::Application::Config()["ExeVendor"] = "FreeCAD";