From 7f92b77997dcc5fa2d1e9455ad2d494fceea9786 Mon Sep 17 00:00:00 2001 From: Bill Hoffman Date: Tue, 20 Jan 2009 10:06:39 -0500 Subject: [PATCH] BUG: fix crash with cmd.exe shell and cmake in the path --- Source/cmSystemTools.cxx | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx index 6c49a144d..0ef750859 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 } //----------------------------------------------------------------------------