Skip to content

Commit

Permalink
MinGW: if PYTHONHOME is not set then automatically do it at program s…
Browse files Browse the repository at this point in the history
…tart
  • Loading branch information
wwmayer committed Sep 23, 2021
1 parent 9bde68d commit b432d12
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/Main/MainCmd.cpp
Expand Up @@ -72,6 +72,13 @@ int main( int argc, char ** argv )
setlocale(LC_ALL, "");
setlocale(LC_NUMERIC, "C");

#if defined(__MINGW32__)
const char* mingw_prefix = getenv("MINGW_PREFIX");
const char* py_home = getenv("PYTHONHOME");
if (!py_home && mingw_prefix)
_putenv_s("PYTHONHOME", mingw_prefix);
#endif

// Name and Version of the Application
App::Application::Config()["ExeName"] = "FreeCAD";
App::Application::Config()["ExeVendor"] = "FreeCAD";
Expand Down
5 changes: 5 additions & 0 deletions src/Main/MainGui.cpp
Expand Up @@ -127,6 +127,11 @@ int main( int argc, char ** argv )
#elif defined(FC_OS_MACOSX)
(void)QLocale::system();
putenv("PYTHONPATH=");
#elif defined(__MINGW32__)
const char* mingw_prefix = getenv("MINGW_PREFIX");
const char* py_home = getenv("PYTHONHOME");
if (!py_home && mingw_prefix)
_putenv_s("PYTHONHOME", mingw_prefix);
#else
_putenv("PYTHONPATH=");
// https://forum.freecadweb.org/viewtopic.php?f=4&t=18288
Expand Down

0 comments on commit b432d12

Please sign in to comment.