CPath: If create dir, and testing if can change in it, revert to previous current dir

This commit is contained in:
zilmar 2013-04-15 13:48:06 +10:00
parent 72471d1eeb
commit dcf9762fb2
1 changed files with 7 additions and 3 deletions

View File

@ -65,7 +65,7 @@ static stdstr RandomDigits(int nDigits)
if(last_digit < 0)
last_digit =(-last_digit);
last_digit %= 10;
Digits[nDigits - 1] ='0' + last_digit;
Digits[nDigits - 1] = (char)('0' + last_digit);
return Digits;
}
@ -2465,8 +2465,12 @@ BOOL CPath::CreateDirectory(BOOL bCreateIntermediates /*= TRUE*/)
StripTrailingBackslash(PathText);
bSuccess =::CreateDirectory(PathText.c_str(),NULL);
if(!bSuccess)
bSuccess =ChangeDirectory();
{
CPath CurrentDir(CPath::CURRENT_DIRECTORY);
bSuccess = ChangeDirectory();
CurrentDir.ChangeDirectory();
}
if(!bSuccess && bCreateIntermediates)
{
stdstr::size_type nDelimiter =PathText.rfind(DIRECTORY_DELIMITER);