Skip to content
Snippets Groups Projects
Commit 1b20cb90 authored by Carlo Camilloni's avatar Carlo Camilloni
Browse files

CLTools: added the possibility of setting PLUMED_ROOT

as an enviroment variable. This should allow to move
more easily a static executable of plumed.

I have implemented solutions 2 and 4 of #129

this close #129
parent 4a161314
No related branches found
No related tags found
No related merge requests found
...@@ -22,6 +22,7 @@ ...@@ -22,6 +22,7 @@
#include "Config.h" #include "Config.h"
#include "version.h" #include "version.h"
#include <cstdlib>
#include <cstring> #include <cstring>
namespace PLMD{ namespace PLMD{
...@@ -36,7 +37,14 @@ bool isInstalled(){ ...@@ -36,7 +37,14 @@ bool isInstalled(){
} }
std::string getPlumedRoot(){ 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(){ std::string getVersion(){
......
...@@ -167,9 +167,8 @@ int CLToolMain::run(int argc, char **argv,FILE*in,FILE*out,Communicator& pc){ ...@@ -167,9 +167,8 @@ int CLToolMain::run(int argc, char **argv,FILE*in,FILE*out,Communicator& pc){
vector<string> files=Tools::ls(root); vector<string> files=Tools::ls(root);
if(find(files.begin(),files.end(),"patches")==files.end()) { if(find(files.begin(),files.end(),"patches")==files.end()) {
string msg= 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()); fprintf(stderr,"%s",msg.c_str());
return 1;
} }
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment