diff options
Diffstat (limited to 'Source/kwsys')
-rw-r--r-- | Source/kwsys/SystemTools.cxx | 8 | ||||
-rw-r--r-- | Source/kwsys/SystemTools.hxx.in | 5 |
2 files changed, 9 insertions, 4 deletions
diff --git a/Source/kwsys/SystemTools.cxx b/Source/kwsys/SystemTools.cxx index 8b26cb3..b7ad66b 100644 --- a/Source/kwsys/SystemTools.cxx +++ b/Source/kwsys/SystemTools.cxx @@ -158,14 +158,18 @@ SystemTools::GetTime(void) } // adds the elements of the env variable path to the arg passed in -void SystemTools::GetPath(kwsys_stl::vector<kwsys_stl::string>& path) +void SystemTools::GetPath(kwsys_stl::vector<kwsys_stl::string>& path, const char* env) { #if defined(_WIN32) && !defined(__CYGWIN__) const char* pathSep = ";"; #else const char* pathSep = ":"; #endif - kwsys_stl::string pathEnv = getenv("PATH"); + if(!env) + { + env = "PATH"; + } + kwsys_stl::string pathEnv = getenv(env); // A hack to make the below algorithm work. if(pathEnv[pathEnv.length()-1] != ':') { diff --git a/Source/kwsys/SystemTools.hxx.in b/Source/kwsys/SystemTools.hxx.in index fc6acf0..1676ff2 100644 --- a/Source/kwsys/SystemTools.hxx.in +++ b/Source/kwsys/SystemTools.hxx.in @@ -121,9 +121,10 @@ public: static unsigned long FileLength(const char *filename); /** * Add the paths from the environment variable PATH to the - * string vector passed in. + * string vector passed in. If env is set then the value + * of env will be used instead of PATH. */ - static void GetPath(kwsys_stl::vector<kwsys_stl::string>& path); + static void GetPath(kwsys_stl::vector<kwsys_stl::string>& path, const char* env=0); /** Read an environment variable. */ static const char* GetEnv(const char* key); |