windows-temp-path-20070416

Use GetTempPath() instead of testing environment variables ourselves.
This commit is contained in:
Jeffrey Altman 2007-04-17 01:04:47 +00:00
parent 5bc88af797
commit 44ca92226a

View File

@ -136,7 +136,7 @@ void afsd_initUpperCaseTable()
void void
afsi_start() afsi_start()
{ {
char wd[256]; char wd[MAX_PATH+1];
char t[100], u[100], *p, *path; char t[100], u[100], *p, *path;
int zilch; int zilch;
DWORD code; DWORD code;
@ -146,13 +146,10 @@ afsi_start()
DWORD maxLogSize = 100 * 1024; DWORD maxLogSize = 100 * 1024;
afsi_file = INVALID_HANDLE_VALUE; afsi_file = INVALID_HANDLE_VALUE;
code = GetEnvironmentVariable("TEMP", wd, sizeof(wd)); code = GetTempPath(sizeof(wd)-15, wd);
if ( code == 0 || code > sizeof(wd) ) if ( code == 0 || code > (sizeof(wd)-15) )
{ return; /* unable to create a log */
code = GetWindowsDirectory(wd, sizeof(wd));
if (code == 0)
return;
}
StringCbCatA(wd, sizeof(wd), "\\afsd_init.log"); StringCbCatA(wd, sizeof(wd), "\\afsd_init.log");
GetTimeFormat(LOCALE_SYSTEM_DEFAULT, 0, NULL, NULL, t, sizeof(t)); GetTimeFormat(LOCALE_SYSTEM_DEFAULT, 0, NULL, NULL, t, sizeof(t));
afsi_file = CreateFile(wd, GENERIC_WRITE, FILE_SHARE_READ, NULL, afsi_file = CreateFile(wd, GENERIC_WRITE, FILE_SHARE_READ, NULL,