Changeset 28990
- Timestamp:
- 2014-04-17T14:47:42+12:00 (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/trunk/greenstone2/common-src/src/lib/gsdlsitecfg.cpp
r28979 r28990 139 139 140 140 text_t javahome(cfgline[0]); 141 text_t oldjavahome = ""; 141 142 142 143 // getenv returns NULL if not set, http://www.cplusplus.com/reference/cstdlib/getenv/ … … 145 146 146 147 if(existing_javahome != NULL) { 147 // cerr goes to: apache-httpd/<OS>/logs/error_log 148 cerr << "Warning: JAVA_HOME is already set to: " << existing_javahome << endl; 149 cerr << "But overwriting with javahome set in gsdlsite.cfg: " << javahome << endl; 150 } 151 152 // http://www.kev.pulo.com.au/pp/RESOURCES/cplusplus/ref/cstdlib/putenv.html 153 // putenv is not defined in ANSI-C, but is supported by many compilers, and is 154 // already used in gtiaction.cpp 155 javahome = "JAVA_HOME=" + javahome; 156 char* set_javahome_cstr = javahome.getcstr(); 157 putenv(set_javahome_cstr); 158 159 // can't use locally declared char array that we string-copy the cstr into, 160 // since the array's value expires from putenv, possibly after this function's local scope 161 // Forced to assign the dynamically allocated cstr and resist the urge to delete this: 162 //delete[] set_javahome_cstr; // may not delete it, else the env var just set will become empty 163 } 148 oldjavahome += existing_javahome; 149 if(javahome != oldjavahome) { 150 // cerr goes to: apache-httpd/<OS>/logs/error_log 151 cerr << "Warning: JAVA_HOME is already set to: " << existing_javahome << endl; 152 cerr << "But overwriting with javahome set in gsdlsite.cfg: " << javahome << endl; 153 } else { 154 cerr << "JAVA_HOME (" << oldjavahome << ") already set to " + javahome << endl; 155 } 156 } 157 158 if(javahome != oldjavahome) { 159 // http://www.kev.pulo.com.au/pp/RESOURCES/cplusplus/ref/cstdlib/putenv.html 160 // putenv is not defined in ANSI-C, but is supported by many compilers, and is 161 // already used in gtiaction.cpp 162 javahome = "JAVA_HOME=" + javahome; 163 char* set_javahome_cstr = javahome.getcstr(); 164 putenv(set_javahome_cstr); 165 166 // can't use locally declared char array that we string-copy the cstr into, 167 // since the array's value expires from putenv, possibly after this function's local scope 168 // Forced to assign the dynamically allocated cstr and resist the urge to delete this: 169 //delete[] set_javahome_cstr; // may not delete it, else the env var just set will become empty 170 } 171 } 164 172 165 173 if (actions != NULL && key == "actions") {
Note:
See TracChangeset
for help on using the changeset viewer.