diff --git a/src/config/Config.cpp.in b/src/config/Config.cpp.in index 0a8885d7de0b2921e532ec57e2a95bb1440e310b..66c391c02521d8844393a037dd2df3bb0cdf2389 100644 --- a/src/config/Config.cpp.in +++ b/src/config/Config.cpp.in @@ -22,6 +22,7 @@ #include "Config.h" #include "version.h" +#include <cstdlib> #include <cstring> namespace PLMD{ @@ -36,7 +37,14 @@ bool isInstalled(){ } std::string getPlumedRoot(){ - return "@PLUMED_ROOT@"; + char *env = std::getenv("PLUMED_ROOT"); + std::string ss; + if( env == NULL) { + ss="@PLUMED_ROOT@"; + } else { + ss=std::string( env ); + } + return ss; } std::string getVersion(){ diff --git a/src/core/CLToolMain.cpp b/src/core/CLToolMain.cpp index 212a1e488559a0eb5d4f143e5fa30792cfe3d5fa..ef97621ecaa8070732214ca20221eaec89c35bc0 100644 --- a/src/core/CLToolMain.cpp +++ b/src/core/CLToolMain.cpp @@ -167,9 +167,8 @@ int CLToolMain::run(int argc, char **argv,FILE*in,FILE*out,Communicator& pc){ vector<string> files=Tools::ls(root); if(find(files.begin(),files.end(),"patches")==files.end()) { string msg= - "ERROR: I cannot find "+root+"/patches/ directory\n"; + "WARNING: I cannot find "+root+"/patches/ directory. Set PLUMED_ROOT or reinstall PLUMED\n\n"; fprintf(stderr,"%s",msg.c_str()); - return 1; } }