Files
bullet3/Demos3/FiniteElementMethod/OpenTissue/utility/utility_get_environment_variable.h
erwin coumans 4b665fa82b add btFileUtils::toLower to convert a string (char*) to lower case
URDF import demo: add COLLADA .dae file support
add FiniteElementMethod demo, extracted from the OpenTissue library (under the zlib license)
don't crash if loading an invalid STL file
add comparison with Assimp for COLLADA file loading (disabled by default, to avoid library dependency)
Gwen: disable some flags that make the build incompatible
2014-10-29 13:18:34 -07:00

45 lines
1.3 KiB
C++

#ifndef OPENTISSUE_UTILITY_UTILITY_GET_ENVIRONMENT_VARIABLE_H
#define OPENTISSUE_UTILITY_UTILITY_GET_ENVIRONMENT_VARIABLE_H
//
// OpenTissue Template Library
// - A generic toolbox for physics-based modeling and simulation.
// Copyright (C) 2008 Department of Computer Science, University of Copenhagen.
//
// OTTL is licensed under zlib: http://opensource.org/licenses/zlib-license.php
//
#include <OpenTissue/configuration.h>
#include <stdexcept>
#include <cstdlib> //--- For getenv
#include <string>
#include <cassert>
namespace OpenTissue
{
namespace utility
{
/**
* Retrieve Value of Environment Variable.
* If environment variable can not be found then a std::logic_error warning is thrown.
*
* @param A string containing the name of the environment
* variable. Example: "OPENTISSUE".
* @return A string containing the value.
*/
inline std::string get_environment_variable(std::string const & name)
{
char * value = getenv( name.c_str() );
if(value)
return std::string( value );
throw std::logic_error("get_environment_variable(): the specified environment variable was not set");
}
} // namespace utility
} // namespace OpenTissue
//OPENTISSUE_UTILITY_UTILITY_GET_ENVIRONMENT_VARIABLE_H
#endif