diff options
author | Bill Hoffman <bill.hoffman@kitware.com> | 2009-01-20 15:06:39 (GMT) |
---|---|---|
committer | Bill Hoffman <bill.hoffman@kitware.com> | 2009-01-20 15:06:39 (GMT) |
commit | 7f92b77997dcc5fa2d1e9455ad2d494fceea9786 (patch) | |
tree | 767a58a9bb6bd7491608dc6e9ecfbd880d295438 /Source/cmSystemTools.cxx | |
parent | 57896e296f9c553052626bbe971c24fa1a16bc6b (diff) | |
download | CMake-7f92b77997dcc5fa2d1e9455ad2d494fceea9786.zip CMake-7f92b77997dcc5fa2d1e9455ad2d494fceea9786.tar.gz CMake-7f92b77997dcc5fa2d1e9455ad2d494fceea9786.tar.bz2 |
BUG: fix crash with cmd.exe shell and cmake in the path
Diffstat (limited to 'Source/cmSystemTools.cxx')
-rw-r--r-- | Source/cmSystemTools.cxx | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx index 6c49a14..0ef7508 100644 --- a/Source/cmSystemTools.cxx +++ b/Source/cmSystemTools.cxx @@ -2242,6 +2242,14 @@ bool cmSystemTools::FileTimeSet(const char* fname, cmSystemToolsFileTime* t) static std::string cmSystemToolsExecutableDirectory; void cmSystemTools::FindExecutableDirectory(const char* argv0) { +#if defined(_WIN32) && !defined(__CYGWIN__) + (void)argv0; // ignore this on windows + char modulepath[_MAX_PATH]; + ::GetModuleFileName(NULL, modulepath, sizeof(modulepath)); + cmSystemToolsExecutableDirectory = + cmSystemTools::GetFilenamePath(modulepath); + return; +#else std::string errorMsg; std::string exe; if(cmSystemTools::FindProgramPath(argv0, exe, errorMsg)) @@ -2255,6 +2263,7 @@ void cmSystemTools::FindExecutableDirectory(const char* argv0) { // ??? } +#endif } //---------------------------------------------------------------------------- |