BUG: fix crash with cmd.exe shell and cmake in the path

This commit is contained in:
Bill Hoffman 2009-01-20 10:06:39 -05:00
parent 57896e296f
commit 7f92b77997
1 changed files with 9 additions and 0 deletions

View File

@ -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
}
//----------------------------------------------------------------------------