Mechanics of Defect Evolution Library
Loading...
Searching...
No Matches
EnvVariable.cpp
Go to the documentation of this file.
1/* This file is part of MoDELib, distributed under GNU GPL v2. */
2#include <EnvVariable.h>
3#include <cstdlib>
4#include <string.h>
5#include <assert.h>
6
7namespace model
8{
9
10 auto EnvVariable::getVariable(const std::string &varname) -> std::string
11 {
12 const char *tmpvar = std::getenv(varname.c_str());
13 assert(tmpvar != 0 && *tmpvar != '\0' && "FAILED TO GET ENVIRONMENT VARIABLE.");
14 return tmpvar;
15 }
16
17 EnvVariable::EnvVariable(const std::string &varname) : std::string(getVariable(varname))
18 {
19 }
20} // namespace model
EnvVariable(const std::string &varname)
static std::string getVariable(const std::string &varname)
char infilename char * string