ENH: Added GetEnv method.
This commit is contained in:
parent
40ea4b6761
commit
8ca149d34f
@ -190,6 +190,24 @@ void SystemTools::GetPath(kwsys_std::vector<kwsys_std::string>& path)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const char* SystemTools::GetEnv(const char* key)
|
||||||
|
{
|
||||||
|
return getenv(key);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool SystemTools::GetEnv(const char* key, kwsys_std::string& result)
|
||||||
|
{
|
||||||
|
const char* v = getenv(key);
|
||||||
|
if(v)
|
||||||
|
{
|
||||||
|
result = v;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const char* SystemTools::GetExecutableExtension()
|
const char* SystemTools::GetExecutableExtension()
|
||||||
{
|
{
|
||||||
|
@ -124,6 +124,10 @@ public:
|
|||||||
*/
|
*/
|
||||||
static void GetPath(kwsys_std::vector<kwsys_std::string>& path);
|
static void GetPath(kwsys_std::vector<kwsys_std::string>& path);
|
||||||
|
|
||||||
|
/** Read an environment variable. */
|
||||||
|
static const char* GetEnv(const char* key);
|
||||||
|
static bool GetEnv(const char* key, std::string& result);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the file extension (including ".") needed for an executable
|
* Get the file extension (including ".") needed for an executable
|
||||||
* on the current platform ("" for unix, ".exe" for Windows).
|
* on the current platform ("" for unix, ".exe" for Windows).
|
||||||
|
Loading…
x
Reference in New Issue
Block a user