Skip to content
Snippets Groups Projects
Commit 86e207ce authored by Christophe Geuzaine's avatar Christophe Geuzaine
Browse files

set PYTHONPATH to path of gmsh binary

parent 8d277a9f
No related branches found
No related tags found
No related merge requests found
......@@ -268,7 +268,6 @@ void GetOptions(int argc, char *argv[])
#if defined(HAVE_PARSER)
if(argc && argv){
CTX::instance()->argv0 = std::string(argv[0]);
// parse session and option file (if argc/argv is not provided skip this
// step: this is usually what is expected when using Gmsh as a library)
ParseFile(CTX::instance()->homeDir + CTX::instance()->sessionFileName, true);
......
......@@ -59,9 +59,7 @@ CTX::CTX() : gamepad(0)
post.draw = 1;
post.combineTime = 0; // try to combineTime views at startup
lock = 0; // very primitive locking
///
fileread=false;
///
#if defined(HAVE_FLTK)
glFontEnum = FL_HELVETICA;
......
......@@ -17,6 +17,7 @@
#include "Options.h"
#include "Context.h"
#include "OpenFile.h"
#include "StringUtils.h"
#include "OS.h"
#if defined(HAVE_ONELAB)
......@@ -112,6 +113,25 @@ void Msg::Init(int argc, char **argv)
if(i) _commandLine += " ";
_commandLine += argv[i];
}
if(argc && argv){
CTX::instance()->argv0 = std::string(argv[0]);
std::vector<std::string> split = SplitFileName(CTX::instance()->argv0);
// add the directory where the binary is installed to the path where Python
// looks for modules
std::string path;
char *tmp = getenv("PYTHONPATH");
if(tmp){
path = tmp;
path += ":" + split[0];
}
else
path = split[0];
setenv("PYTHONPATH", path.c_str(), 1);
printf("pythonpath = %s\n", path.c_str());
}
InitializeOnelab("Gmsh");
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment