- Check if the temp directory exist, if not use the current directory.

svn path=/trunk/; revision=9639
This commit is contained in:
Hartmut Birr 2004-06-06 17:33:13 +00:00
parent 4a7c01adb6
commit 440fa78c14

View file

@ -1,4 +1,4 @@
/* $Id: cmd.c,v 1.14 2004/06/06 08:58:56 hbirr Exp $ /* $Id: cmd.c,v 1.15 2004/06/06 17:33:13 hbirr Exp $
* *
* CMD.C - command-line interface. * CMD.C - command-line interface.
* *
@ -497,6 +497,7 @@ VOID ParseCommandLine (LPTSTR cmd)
INT num = 0; INT num = 0;
INT nRedirFlags = 0; INT nRedirFlags = 0;
INT Length; INT Length;
UINT Attributes;
HANDLE hOldConIn; HANDLE hOldConIn;
HANDLE hOldConOut; HANDLE hOldConOut;
@ -518,6 +519,15 @@ VOID ParseCommandLine (LPTSTR cmd)
#ifdef FEATURE_REDIRECTION #ifdef FEATURE_REDIRECTION
/* find the temp path to store temporary files */ /* find the temp path to store temporary files */
Length = GetTempPath (MAX_PATH, szTempPath); Length = GetTempPath (MAX_PATH, szTempPath);
if (Length > 0 && Length < MAX_PATH)
{
Attributes = GetFileAttributes(szTempPath);
if (Attributes == 0xffffffff ||
!(Attributes & FILE_ATTRIBUTE_DIRECTORY))
{
Length = 0;
}
}
if (Length == 0 || Length >= MAX_PATH) if (Length == 0 || Length >= MAX_PATH)
{ {
_tcscpy(szTempPath, _T(".\\")); _tcscpy(szTempPath, _T(".\\"));