workaround for bug in VS 2013 that occurs at Python init time
This commit is contained in:
@@ -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";
|
||||
|
||||
Reference in New Issue
Block a user