inlib
1.2.0
|
00001 // Copyright (C) 2010, Guy Barrand. All rights reserved. 00002 // See the file inlib.license for terms. 00003 00004 #ifndef inlib_osc_env 00005 #define inlib_osc_env 00006 00007 #include "system" 00008 #include "sep" 00009 00010 namespace inlib { 00011 namespace osc { 00012 00013 inline bool set_env(std::ostream& a_out){ 00014 00015 std::string OSC_HOME_DIR; 00016 if(!inlib::getenv("OSC_HOME_DIR",OSC_HOME_DIR)) { 00017 a_out << "inlib::osc::set_env :" 00018 << " Environment variable OSC_HOME_DIR not defined." 00019 << " You have to setup OpenScientist by sourcing " 00020 << " the setup script, found in the distribution," 00021 << " corresponding to your kind of shell." 00022 << std::endl; 00023 return false; 00024 } 00025 00026 std::string fs = inlib::sep(); 00027 00028 //NOTE : ONXROOT is used to find <ref> common .onx files. 00029 // Also used in OnX/examples. 00030 std::string ONXROOT = OSC_HOME_DIR + fs + "Resources" + fs + "OnX"; 00031 if(!inlib::putenv("ONXROOT",ONXROOT)) return false; 00032 00033 if(!inlib::env_path_append 00034 ("TTFPATH",OSC_HOME_DIR+fs+"Resources"+fs+"HEPVis"+fs+"fonts")) return false; 00035 00036 #ifdef WIN32 00037 //inlib::putenv("ONX_HAS_PYTHON","no") 00038 #else 00039 #ifdef __APPLE__ 00040 inlib::putenv("ONX_HAS_PYTHON","yes"); 00041 #else // Linux 00042 //inlib::putenv("ONX_HAS_PYTHON","no") 00043 #endif 00044 #endif 00045 00046 if(!inlib::env_path_append("PYTHONPATH", 00047 OSC_HOME_DIR+fs+"Resources"+fs+"OnX"+fs+"scripts"+fs+"Python")) return false; 00048 if(!inlib::env_path_append("PYTHONPATH", 00049 OSC_HOME_DIR+fs+"Resources"+fs+"CoinPython"+fs+"scripts")) return false; 00050 if(!inlib::env_path_append("PYTHONPATH", 00051 OSC_HOME_DIR+fs+"Resources"+fs+"HEPVis"+fs+"scripts"+fs+"Python")) 00052 return false; 00053 if(!inlib::env_path_append("PYTHONPATH",OSC_HOME_DIR+fs+"bin")) return false; 00054 00055 return true; 00056 } 00057 00058 }} 00059 00060 #endif