mirror of
https://github.com/ivellioscolin/pykd.git
synced 2025-04-20 03:23:23 +08:00
[pykd] fixed: issue 8499 ( !py command crashs with wrong script's path )
git-svn-id: https://pykd.svn.codeplex.com/svn@63927 9b283d60-5439-405e-af05-b73fd8c4d996
This commit is contained in:
parent
494b59b9ef
commit
30d291750a
@ -566,22 +566,14 @@ py( PDEBUG_CLIENT4 client, PCSTR args)
|
||||
std::string filePath;
|
||||
DbgPythonPath dbgPythonPath;
|
||||
|
||||
|
||||
if ( dbgPythonPath.findPath( argsList[0], fullFileName, filePath ) )
|
||||
{
|
||||
DWORD oldCurDirLen = GetCurrentDirectoryA( 0, NULL );
|
||||
|
||||
std::vector<char> oldCurDirCstr(oldCurDirLen);
|
||||
|
||||
GetCurrentDirectoryA( oldCurDirLen, &oldCurDirCstr[0] );
|
||||
|
||||
// SetCurrentDirectoryA( filePath.c_str() );
|
||||
|
||||
try {
|
||||
|
||||
try {
|
||||
|
||||
boost::python::object result;
|
||||
|
||||
result = boost::python::exec_file( fullFileName.c_str(), global, global );
|
||||
|
||||
}
|
||||
catch( boost::python::error_already_set const & )
|
||||
{
|
||||
@ -603,13 +595,11 @@ py( PDEBUG_CLIENT4 client, PCSTR args)
|
||||
Py_XDECREF(errtype);
|
||||
Py_XDECREF(traceback);
|
||||
}
|
||||
|
||||
SetCurrentDirectoryA( &oldCurDirCstr[0] );
|
||||
}
|
||||
else
|
||||
{
|
||||
dbgExt->control->Output( DEBUG_OUTPUT_ERROR, "script file not found\n" );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
catch(...)
|
||||
|
@ -86,6 +86,7 @@ DbgPythonPath::findPath(
|
||||
|
||||
if ( bufSize > 0 )
|
||||
{
|
||||
bufSize += 1;
|
||||
std::vector<char> fullFileNameCStr(bufSize);
|
||||
char *partFileNameCStr = NULL;
|
||||
|
||||
@ -95,12 +96,14 @@ DbgPythonPath::findPath(
|
||||
pyExt ? NULL : ".py",
|
||||
bufSize,
|
||||
&fullFileNameCStr[0],
|
||||
&partFileNameCStr );
|
||||
&partFileNameCStr );
|
||||
|
||||
fullFileName = std::string( &fullFileNameCStr[0] );
|
||||
filePath = std::string( &fullFileNameCStr[0], partFileNameCStr );
|
||||
|
||||
return true;
|
||||
if ( !fullFileName.empty() )
|
||||
{
|
||||
filePath = std::string( &fullFileNameCStr[0], partFileNameCStr );
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
// 2. Èùåì âî âñåõ äèğåêòîğèÿõ, óêàçàííûõ â m_pathList
|
||||
@ -120,21 +123,24 @@ DbgPythonPath::findPath(
|
||||
|
||||
if ( bufSize > 0 )
|
||||
{
|
||||
bufSize += 1;
|
||||
std::vector<char> fullFileNameCStr(bufSize);
|
||||
char *partFileNameCStr = NULL;
|
||||
|
||||
SearchPathA(
|
||||
bufSize = SearchPathA(
|
||||
(*it).c_str(),
|
||||
fileName.c_str(),
|
||||
pyExt ? NULL : ".py",
|
||||
bufSize,
|
||||
&fullFileNameCStr[0],
|
||||
&partFileNameCStr );
|
||||
|
||||
fullFileName = std::string( &fullFileNameCStr[0] );
|
||||
filePath = std::string( &fullFileNameCStr[0], partFileNameCStr );
|
||||
|
||||
return true;
|
||||
&partFileNameCStr );
|
||||
|
||||
fullFileName = std::string( &fullFileNameCStr[0] );
|
||||
if ( !fullFileName.empty() )
|
||||
{
|
||||
filePath = std::string( &fullFileNameCStr[0], partFileNameCStr );
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user